-
-
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/browser not working in chrome extensions #5289
Comments
When tackling this issue we should set up an example chrome extension to properly test our fix. I think it also might be a good idea to rethink how we make use of |
I'm getting a similar error ( |
Hello there :) // Run this code before Sentry.init(...)
Sentry.WINDOW.document = {
visibilityState: 'hidden',
addEventListener: () => {},
}; Ofcourse this isn't a long term solution and we will update as soon as this issue is closed 😄 BTW, if there are other people arriving on this thread while trying to add tracing to their manifest V3 extension make sure that you create a new transaction around the code that you need to be traced. It took us quite some time to understand that there is no transaction like chrome.alarms.onAlarm.addListener(async (alarm: Alarm) => {
// Generic Sentry.init(....)
setupSentry();
const transaction = Sentry.startTransaction({ name: `Alarm ${alarm.name} rang` });
Sentry.getCurrentHub().configureScope((scope) => scope.setSpan(transaction));
// Do your thing
// ....
transaction.finish();
} Hope this helps :) |
Is ur issue resolved now?? |
I'm also getting this error. |
@abhishek871 @JUDE-EQ Usually these errors originate from browser extensions that your users are using. You can filter these out with the |
This solved my issue, but my Sentry.captureException seem to not get received in my dashboard even though they get sent. |
@alexandredepape seems like you solved it? |
It solved the fact that the service worker was not working after adding the call to Sentry.init but after doing this, it fixed it in the sense that it was not crashing anymore: My bigger issue is here Where the request are sent but nothing is displayed in my dashboard, maybe I'm missing something |
I opened a PR to stomp places that look like may fail in web workers: #11598 |
@lforst Yet to test this, but just wanted to say thanks. Appreciate this issue getting some love, as it's been a big blocker to us in several respects 🚀 |
@nonparibus Yeah sorry about neglecting this. Personally, I would love for us to have some lightweight SDK that doesn't depend on any runtime specific API. Technically this is already possible for you to implement but it requires a ton of boilerplate. |
@stevenmason This message should appear as part of the deduplicating logic in the SDK. Are you attempting to send the same error instance twice? Or is this happening 100% of the time? |
Thank you for the response. 100% of the time, no errors are coming through when using |
@stevenmason I think this is a separate issue. Would you mind opening a new one and providing a reproduction example? Thank you! |
This issue has gone three weeks without activity. In another week, I will close it. But! If you comment or otherwise update it, I will reset the clock, and if you remove the label "A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀 |
When importing
@sentry/browser
from a service worker file (e.g: background.js) likewe get
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)
The text was updated successfully, but these errors were encountered: