-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed as not planned
Labels
Description
When importing @sentry/browser
from a service worker file (e.g: background.js) like
import * as Sentry from '@sentry/browser';
we get
Uncaught TypeError: Cannot read properties of undefined (reading 'visibilityState')
var initHiddenTime = () => {
return (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_0__.getGlobalObject)().document.visibilityState === 'hidden' ? 0 : Infinity;
};
It crashes at the import level, because @sentry/browser relies on the document
which doesn't exist in the context of a background script.
Edit: That's because I was loading BrowserTracing
, when removing it it doesn't crash!
Originally posted by @Vadorequest in #4098 (comment)
Vadorequest, borfig, hyoav, pohy, jcblw and 15 moreamitbeck
Metadata
Metadata
Assignees
Labels
Projects
Status
No status
Status
No status
Status
Waiting for: Community