Skip to content

Commit

Permalink
fix(nextjs): Client code should not use Node global (#10925)
Browse files Browse the repository at this point in the history
Found while working through ESM issues in #10833.

For whatever reason this passes all the integration tests until ESM is
used 🤯
  • Loading branch information
timfish committed Mar 5, 2024
1 parent c502b64 commit 0a0f733
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion packages/nextjs/src/client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { addEventProcessor, applySdkMetadata, hasTracingEnabled, setTag } from '
import type { BrowserOptions } from '@sentry/react';
import { getDefaultIntegrations as getReactDefaultIntegrations, init as reactInit } from '@sentry/react';
import type { EventProcessor, Integration } from '@sentry/types';
import { GLOBAL_OBJ } from '@sentry/utils';

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

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

const globalWithInjectedValues = global as typeof global & {
const globalWithInjectedValues = GLOBAL_OBJ as typeof GLOBAL_OBJ & {
__rewriteFramesAssetPrefixPath__: string;
};

Expand Down
4 changes: 2 additions & 2 deletions packages/nextjs/src/client/tunnelRoute.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { BrowserOptions } from '@sentry/react';
import { dsnFromString, logger } from '@sentry/utils';
import { GLOBAL_OBJ, dsnFromString, logger } from '@sentry/utils';

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

const globalWithInjectedValues = global as typeof global & {
const globalWithInjectedValues = GLOBAL_OBJ as typeof GLOBAL_OBJ & {
__sentryRewritesTunnelPath__?: string;
};

Expand Down

0 comments on commit 0a0f733

Please sign in to comment.