Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion packages/browser/src/sdk.ts
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
import { getCurrentHub, initAndBind, Integrations as CoreIntegrations, SDK_VERSION } from '@sentry/core';
import { addInstrumentationHandler, getGlobalObject, SyncPromise } from '@sentry/utils';
import { addInstrumentationHandler, getGlobalObject, logger, SyncPromise } from '@sentry/utils';

import { BrowserOptions } from './backend';
import { BrowserClient } from './client';
Expand DownExpand Up@@ -192,6 +192,13 @@ export function wrap(fn: (...args: any) => any): any {
*/
function startSessionTracking(): void {
const window = getGlobalObject<Window>();
const document = window.document;

if (typeof document === 'undefined') {
logger.warn('Session tracking in non-browser environment with @sentry/browser is not supported.')
return;
}

const hub = getCurrentHub();

/**
Expand Down