Skip to content

Commit 8d639f4

Browse files
committed
...
1 parent 669c71b commit 8d639f4

File tree

2 files changed

+12
-0
lines changed
  • dev-packages/e2e-tests/test-applications/nextjs-15-spotlight/app
  • packages/nextjs/src/client

2 files changed

+12
-0
lines changed

dev-packages/e2e-tests/test-applications/nextjs-15-spotlight/app/page.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ const INTERNAL_SPOTLIGHT_GLOBAL = typeof globalThis !== 'undefined' ? globalThis
1313
const MANUAL_SPOTLIGHT_GLOBAL = typeof globalThis !== 'undefined' ? globalThis._sentrySpotlightManual : 'globalThis undefined';
1414
// @ts-expect-error - accessing SDK debug info
1515
const SDK_DEBUG_INFO = typeof globalThis !== 'undefined' ? globalThis._sentrySpotlightDebug : undefined;
16+
// @ts-expect-error - accessing init marker
17+
const INIT_CALLED = typeof globalThis !== 'undefined' ? globalThis._sentryNextjsInitCalled : undefined;
18+
// @ts-expect-error - accessing init timestamp
19+
const INIT_TIMESTAMP = typeof globalThis !== 'undefined' ? globalThis._sentryNextjsInitTimestamp : undefined;
1620

1721
export default function SpotlightTestPage() {
1822
const [spotlightEnabled, setSpotlightEnabled] = useState<boolean | null>(null);
@@ -56,6 +60,8 @@ export default function SpotlightTestPage() {
5660

5761
<div data-testid="sdk-debug">
5862
<h2>SDK Debug Info (what SDK saw during init)</h2>
63+
<p>init() called: {String(INIT_CALLED)}</p>
64+
<p>init() timestamp: {String(INIT_TIMESTAMP)}</p>
5965
<pre>{SDK_DEBUG_INFO ? JSON.stringify(SDK_DEBUG_INFO, null, 2) : 'No debug info'}</pre>
6066
</div>
6167

packages/nextjs/src/client/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ declare const __SENTRY_TRACING__: boolean;
5252

5353
/** Inits the Sentry NextJS SDK on the browser with the React SDK. */
5454
export function init(options: BrowserOptions): Client | undefined {
55+
// Debug marker to verify this init() is being called
56+
if (typeof globalThis !== 'undefined') {
57+
(globalThis as Record<string, unknown>)._sentryNextjsInitCalled = true;
58+
(globalThis as Record<string, unknown>)._sentryNextjsInitTimestamp = Date.now();
59+
}
60+
5561
if (clientIsInitialized) {
5662
consoleSandbox(() => {
5763
// eslint-disable-next-line no-console

0 commit comments

Comments
 (0)