-
Notifications
You must be signed in to change notification settings - Fork 62
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
Chrome Extension: window is not defined
for background scripts
#686
Comments
Hmmm. I would love to avoid a situation where we have to guard access to That said, something similar came up w/ someone who was trying to integrate with a Cloudflare worker (which is also on my integration wishlist). |
Instead of window we can use self. I have tried to to use smth like And service worker uses only fetch API |
@subzero10 any updates on this? |
Hey @christianopaets, I haven't looked into this since January. It's in my todo list, I will try to bump it up. |
It would be really useful when working with a Browser extension as manifest v3 is becoming the norm... |
Hello, we run a popular Chrome extension. And Honeybadger is an essential component of error reporting for us. Google Chrome has mandated all Chrome extensions to be migrated to Manifest V3 and one of the notable changes of MV3 is that it replaces background pages with service workers. The DOM and We tried to fork and patch the library to make it compatible with service workers by replacing It would be nice if you can look into this issue and make Honeybadger compatible with Manifest V3 soon as Google Chrome will not accept any extensions without MV3 after June 2023 and will actively remove them after Jan 2024. https://developer.chrome.com/blog/more-mv2-transition/ |
Hey @zhanfengh, thank you for your insights and feedback. Then, I guess I should look into this before the EOY! |
You can alternatively substitute It looks like For transport.ts you can do something like this, substituting
|
Thanks @guest271314, I will try this out! |
Alright, theres a ton of calls beyond the transport.ts file mentioned, thats probably just the first code path that gets hit. we make a lot of calls to window objects and XMLHTTPRequest, I'm gonna keep plugging through it, but heres an initial PR for what the |
Hey all, we just released |
Looks like
window
is not available in background scripts.Bug first reported here.
The text was updated successfully, but these errors were encountered: