-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sentry does not init in browser extension's service worker #13152
Comments
Hey @ddomonkos thanks for writing in!
Right, this is what we need to confirm. The serviceWorker's Do you know if there's a unique property on the |
Hi @Lms24, while I don't consider myself to be an expert in the service workers domain, I can observe that |
Hey @ddomonkos I relaxed this check a bit in general in #13156 so that global scopes that are not the window global scope are generally exempted. For now I think this should fix your issue as well without special casing service workers. We'll merge this soon and include it in the next release. |
Is there an existing issue for this?
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/browser
SDK Version
8.21.0
Framework Version
No response
Link to Sentry event
No response
Reproduction Example/SDK Setup
No response
Steps to Reproduce
Sentry.init
in the service worker (this used to be the "background script")Expected Result
Sentry initializes without error.
Actual Result
An error is printed out:
Relevant PRs:
The problem is with the condition
WINDOW === WINDOW.top
. In a service worker,WINDOW
is resolved toglobalThis
andglobalThis.top
isundefined
.However, AFAIK it still applies that service worker's context is not shared, i.e. it should be fine to initialize Sentry there.
The text was updated successfully, but these errors were encountered: