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 1
1
import { 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' ;
3
3
4
4
import { BrowserOptions } from './backend' ;
5
5
import { BrowserClient } from './client' ;
@@ -192,6 +192,13 @@ export function wrap(fn: (...args: any) => any): any {
192
192
*/
193
193
function startSessionTracking ( ) : void {
194
194
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
+
195
202
const hub = getCurrentHub ( ) ;
196
203
197
204
/**
You can’t perform that action at this time.
0 commit comments