File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change 11import { getCurrentHub , initAndBind , Integrations as CoreIntegrations , SDK_VERSION } from '@sentry/core' ;
2- import { addInstrumentationHandler , getGlobalObject , SyncPromise } from '@sentry/utils' ;
2+ import { addInstrumentationHandler , getGlobalObject , logger , SyncPromise } from '@sentry/utils' ;
33
44import { BrowserOptions } from './backend' ;
55import { BrowserClient } from './client' ;
@@ -192,6 +192,13 @@ export function wrap(fn: (...args: any) => any): any {
192192 */
193193function startSessionTracking ( ) : void {
194194 const window = getGlobalObject < Window > ( ) ;
195+ const document = window . document ;
196+
197+ if ( typeof document === 'undefined' ) {
198+ logger . warn ( 'Session tracking in non-browser environment with @sentry/browser is not supported.' )
199+ return ;
200+ }
201+
195202 const hub = getCurrentHub ( ) ;
196203
197204 /**
You can’t perform that action at this time.
0 commit comments