@@ -6,6 +6,12 @@ import * as Sentry from '@sentry/nextjs';
66// Next.js replaces process.env.NEXT_PUBLIC_* at BUILD TIME with literal values
77const NEXT_PUBLIC_SPOTLIGHT_VALUE = process . env . NEXT_PUBLIC_SENTRY_SPOTLIGHT ;
88
9+ // Check globalThis which is where the valueInjectionLoader should put the value
10+ const GLOBALTHIS_SPOTLIGHT_VALUE =
11+ typeof globalThis !== 'undefined'
12+ ? ( globalThis as Record < string , unknown > ) [ 'NEXT_PUBLIC_SENTRY_SPOTLIGHT' ]
13+ : undefined ;
14+
915export default function SpotlightTestPage ( ) {
1016 const [ spotlightEnabled , setSpotlightEnabled ] = useState < boolean | null > ( null ) ;
1117 const [ integrationNames , setIntegrationNames ] = useState < string [ ] > ( [ ] ) ;
@@ -23,7 +29,8 @@ export default function SpotlightTestPage() {
2329
2430 // Log for debugging
2531 console . log ( 'Spotlight test results:' , {
26- envValue : NEXT_PUBLIC_SPOTLIGHT_VALUE ,
32+ processEnvValue : NEXT_PUBLIC_SPOTLIGHT_VALUE ,
33+ globalThisValue : GLOBALTHIS_SPOTLIGHT_VALUE ,
2734 integrationFound : ! ! integration ,
2835 clientExists : ! ! client ,
2936 integrationNames : intNames ,
@@ -36,7 +43,8 @@ export default function SpotlightTestPage() {
3643
3744 < div data-testid = "env-value" >
3845 < h2 > Environment Variable</ h2 >
39- < p > NEXT_PUBLIC_SENTRY_SPOTLIGHT: { NEXT_PUBLIC_SPOTLIGHT_VALUE || 'undefined' } </ p >
46+ < p > process.env: { NEXT_PUBLIC_SPOTLIGHT_VALUE || 'undefined' } </ p >
47+ < p data-testid = "globalthis-value" > globalThis: { String ( GLOBALTHIS_SPOTLIGHT_VALUE ) || 'undefined' } </ p >
4048 </ div >
4149
4250 < div data-testid = "spotlight-status" >
0 commit comments