Skip to content

Commit 0a0f733

Browse files
authored
fix(nextjs): Client code should not use Node global (#10925)
Found while working through ESM issues in #10833. For whatever reason this passes all the integration tests until ESM is used 🤯
1 parent c502b64 commit 0a0f733

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

packages/nextjs/src/client/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { addEventProcessor, applySdkMetadata, hasTracingEnabled, setTag } from '
22
import type { BrowserOptions } from '@sentry/react';
33
import { getDefaultIntegrations as getReactDefaultIntegrations, init as reactInit } from '@sentry/react';
44
import type { EventProcessor, Integration } from '@sentry/types';
5+
import { GLOBAL_OBJ } from '@sentry/utils';
56

67
import { devErrorSymbolicationEventProcessor } from '../common/devErrorSymbolicationEventProcessor';
78
import { getVercelEnv } from '../common/getVercelEnv';
@@ -13,7 +14,7 @@ export * from '@sentry/react';
1314

1415
export { captureUnderscoreErrorException } from '../common/_error';
1516

16-
const globalWithInjectedValues = global as typeof global & {
17+
const globalWithInjectedValues = GLOBAL_OBJ as typeof GLOBAL_OBJ & {
1718
__rewriteFramesAssetPrefixPath__: string;
1819
};
1920

packages/nextjs/src/client/tunnelRoute.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import type { BrowserOptions } from '@sentry/react';
2-
import { dsnFromString, logger } from '@sentry/utils';
2+
import { GLOBAL_OBJ, dsnFromString, logger } from '@sentry/utils';
33

44
import { DEBUG_BUILD } from '../common/debug-build';
55

6-
const globalWithInjectedValues = global as typeof global & {
6+
const globalWithInjectedValues = GLOBAL_OBJ as typeof GLOBAL_OBJ & {
77
__sentryRewritesTunnelPath__?: string;
88
};
99

0 commit comments

Comments
 (0)