-
-
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 Init failing in Chrome Extension Manifest V3 #4098
Comments
Please find the following the initialization.
I've removed the |
@abhishekops, thanks for reporting this. Could you provide a simple repro case (ideally a repo) for us to work on? |
@onurtemizkan You may find the sample repo here. You can upload the |
Thanks for the repo @abhishekops. Currently, the default
Also, you can manually trace the critical parts of your background scripts. I can confirm that using custom performance instrumentation works for your case. Please let me know if this helps. |
Thanks @onurtemizkan! I can confirm the work-around you suggested works in my case. As for the instrumentation, we can go the custom route for now. Though we would like the out of the box instrumentation, is there any plans to remove/bypass the window dependency in the coming releases? Thanks. |
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 label it "A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀 |
@onurtemizkan Any update on the ETA for supporting this by default? |
Hello there, I am using Manifest V3 and used this script that was shared by @abhishekops
But still I am not getting any log, is there any other solution to integrate Sentry with Manifest V3. |
Did you find any solution? @mhkhansahab |
Yeah @JamesXiaoFF, I have found the solution.
In Content Script and PopupJS I used @sentry/browser, you can use below snippet:
|
Hi, Raven.js is a very old version of our Sentry SDK and using it is discouraged! I just merged a PR that should fix this issue. We will have a release candidate for our upcoming v7 version soon. Please try it out and report back whether the fix resolved your issue! |
I see v7.2 has been released 3 days ago, does that mean this fix has been released too? Is there an up-to-date example on how to add Sentry for Chrome extension? I understand the main issue lies with the service worker (e.g: background.js), while the rest should work just fine. |
Yes, this should be fixed with v7. We do not yet have an up-to-date example on how to set up Sentry with Chrome extensions. For transparency reasons I should also mention that chrome extensions are currently not really on our radar. We try to keep the SDK compatible with extensions, but it's not something we explicitly test for. Most of the time the Side-note to extension authors: Injecting the Sentry SDK on arbitrary pages is highly discouraged. Injected Sentry SDKs might clash with a Sentry SDK already running on a page. Not only will this mean that the SDK you injected most likely won't work, but also you break the SDK the website is already running - ruining fun for everyone. |
Thanks for the feedback, I believe a "safe" example dedicated to extensions should come to light then, especially since it's not straightforward to configure it properly. |
Well, it's still not working at all when importing
It crashes at the import level, because @sentry/browser relies on the Edit: That's because I was loading |
@Vadorequest sorry about that. I created a follow-up issue with the bug you described instead of reopening this one, because the bug is a different one. For the time being, I recommend chrome extension authors not to use the tracing package. |
Package + Version
@sentry/browser
@sentry/node
raven-js
raven-node
(raven for node)Version:
Description
Apologies if this was asked previously. I'm trying to integrate Sentry into background scripts of Chrome Extension manifest V3. Sentry Initi fails with the following trace, upon digging into it, the exact line where it fails is
https://imgur.com/a/UAGs5QR
Actual error trace:
This is expected to fail as the manifest V3 version of Chrome Extension background scripts don't have access to DOM, and they are run as service workers, which explains the issue. I would like to know if there is a way to integrate Sentry where window/document objects aren't present. Its really critical for us to integrate Sentry into the background scripts, as most of the important action happens there. Kindly assist if there is a solution or any workarounds for the problem. Thanks in advance.
The text was updated successfully, but these errors were encountered: