Skip to content
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

Improve Sentry instrumentation of the extension itself #40

Open
cstavitsky opened this issue Apr 4, 2023 · 0 comments
Open

Improve Sentry instrumentation of the extension itself #40

cstavitsky opened this issue Apr 4, 2023 · 0 comments

Comments

@cstavitsky
Copy link
Contributor

What we currently do, what I tried:

  • installed Sentry using npm

  • configured Sentry per normal JS instructions, initializing it in content.js

  • received an error message: Uncaught SyntaxError: Cannot use import statement outside a module (at content.js:11:1)

  • in package.json, added a top-level key "type": "module" (but this did not fix the issue as stackoverflow suggested). More stackoverflowing led to more dead ends 😕

  • Another resource I looked into: adding sentry to chrome extension — this was not exactly needed since technically content.js does not run as a service worker — it gets appended to the DOM using injectScript

  • I also tried injecting the sentry script itself, re-using the injectScript function but passing the src as the CDN sentry link. But when I do that, then try to Sentry.init I get: Uncaught ReferenceError: Sentry is not defined.

@ndmanvar 's idea for improvement:

random idea: if there is an error (with content.js), store the error in localstorage, and then have popup.js read off of that and send up (via Sentry.captureException / captureMessage) ? (edited)
^ i.e. wrap all of content.js essentialy in a try/catch, and then do the above in catch?

@cstavitsky cstavitsky changed the title Improve Sentry instrumentation Improve Sentry instrumentation of the extension itself Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant