File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed
dev-packages/e2e-tests/test-applications/nextjs-15-spotlight/app
packages/nextjs/src/client Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,10 @@ const INTERNAL_SPOTLIGHT_GLOBAL = typeof globalThis !== 'undefined' ? globalThis
1313const MANUAL_SPOTLIGHT_GLOBAL = typeof globalThis !== 'undefined' ? globalThis . _sentrySpotlightManual : 'globalThis undefined' ;
1414// @ts -expect-error - accessing SDK debug info
1515const 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
1721export 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
Original file line number Diff line number Diff 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. */
5454export 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
You can’t perform that action at this time.
0 commit comments