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 authored and AbhiPrasad committed Mar 7, 2024
1 parent ef59a91 commit f26f68c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion packages/nextjs/src/client/rewriteFramesIntegration.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { defineIntegration } from '@sentry/core';
import { rewriteFramesIntegration as originalRewriteFramesIntegration } from '@sentry/integrations';
import type { IntegrationFn, StackFrame } from '@sentry/types';
import { GLOBAL_OBJ } from '@sentry/utils';

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
4 changes: 2 additions & 2 deletions packages/nextjs/src/server/rewriteFramesIntegration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import {
rewriteFramesIntegration as originalRewriteFramesIntegration,
} from '@sentry/integrations';
import type { IntegrationFn, StackFrame } from '@sentry/types';
import { escapeStringForRegex } from '@sentry/utils';
import { GLOBAL_OBJ, escapeStringForRegex } from '@sentry/utils';

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

Expand Down

0 comments on commit f26f68c

Please sign in to comment.