Title: Sentry Init failing in Chrome Extension Manifest V3 · Issue #4098 · getsentry/sentry-javascript · GitHub
Open Graph Title: Sentry Init failing in Chrome Extension Manifest V3 · Issue #4098 · getsentry/sentry-javascript
X Title: Sentry Init failing in Chrome Extension Manifest V3 · Issue #4098 · getsentry/sentry-javascript
Description: Review the documentation: https://docs.sentry.io/ Search for existing issues: https://github.com/getsentry/sentry-javascript/issues Use the latest release: https://github.com/getsentry/sentry-javascript/releases Provide a link to the aff...
Open Graph Description: Review the documentation: https://docs.sentry.io/ Search for existing issues: https://github.com/getsentry/sentry-javascript/issues Use the latest release: https://github.com/getsentry/sentry-javas...
X Description: Review the documentation: https://docs.sentry.io/ Search for existing issues: https://github.com/getsentry/sentry-javascript/issues Use the latest release: https://github.com/getsentry/sentry-javas...
Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/4098
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Sentry Init failing in Chrome Extension Manifest V3","articleBody":"\u003c!-- Requirements: please go through this checklist before opening a new issue -->\r\n\r\n- [x] Review the documentation: https://docs.sentry.io/\r\n- [x] Search for existing issues: https://github.com/getsentry/sentry-javascript/issues\r\n- [x] Use the latest release: https://github.com/getsentry/sentry-javascript/releases\r\n- [ ] Provide a link to the affected event from your Sentry account\r\n\r\n## Package + Version\r\n\r\n- [x] `@sentry/browser`\r\n- [ ] `@sentry/node`\r\n- [ ] `raven-js`\r\n- [ ] `raven-node` _(raven for node)_\r\n- [ ] other:\r\n\r\n### Version:\r\n\r\n```\r\n6.13.3\r\n```\r\n\r\n## Description\r\n\r\nApologies 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\r\nhttps://imgur.com/a/UAGs5QR\r\n\r\nActual error trace:\r\n```Error in Sentry init TypeError: Cannot read properties of undefined (reading 'querySelector')\r\nError in Sentry init TypeError: Cannot read properties of undefined (reading 'querySelector')\r\n at y (background.bundle.js:118)\r\n at g (background.bundle.js:118)\r\n at e._createRouteTransaction (background.bundle.js:118)\r\n at background.bundle.js:118\r\n at a (background.bundle.js:127)\r\n at e.setupOnce (background.bundle.js:118)\r\n at l (background.bundle.js:79)\r\n at background.bundle.js:79\r\n at Array.forEach (\u003canonymous>)\r\n at d (background.bundle.js:79)\r\n at t.setupIntegrations (background.bundle.js:76)\r\n at e.bindClient (background.bundle.js:103)\r\n at o (background.bundle.js:94)\r\n at Module.S (background.bundle.js:46)\r\n at background.bundle.js:307\r\n at background.bundle.js:307\r\n at background.bundle.js:307\r\n at background.bundle.js:307\r\n```\r\n\r\nThis is expected to fail as the manifest V3 version of **Chrome Extension** background scripts don't have access to [DOM](https://developer.chrome.com/docs/extensions/mv3/migrating_to_service_workers/#documents), 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.","author":{"url":"https://github.com/abhishekops","@type":"Person","name":"abhishekops"},"datePublished":"2021-10-28T11:10:11Z","url":"https://github.com/getsentry/sentry-javascript/issues/4098"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:b8626e02-71af-139a-0926-156e25f78bc4 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8216:2A56F5:525B:69EA:6B0429AE |
| html-safe-nonce | a3269d574825ed8fd0dbc1f92724bed75ec4a7cd0b9cf0e10db61901a4ae1aa1 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MjE2OjJBNTZGNTo1MjVCOjY5RUE6NkIwNDI5QUUiLCJ2aXNpdG9yX2lkIjoiMTg2MTIyMDQ2MzE1NDU3MTY5NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | ec017ace78cf05cc36aedd41929d5f60b0018b6788e6a12acf2197ae66f45c4c |
| hovercard-subject-tag | issue:1038387318 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-javascript/4098/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c46de903cb94ac827c95520bcb4eb1566333fd9f73b96d44578847aaf6348c6f/getsentry/sentry-javascript/issues/4098 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c46de903cb94ac827c95520bcb4eb1566333fd9f73b96d44578847aaf6348c6f/getsentry/sentry-javascript/issues/4098 |
| og:image:alt | Review the documentation: https://docs.sentry.io/ Search for existing issues: https://github.com/getsentry/sentry-javascript/issues Use the latest release: https://github.com/getsentry/sentry-javas... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | abhishekops |
| hostname | github.com |
| expected-hostname | github.com |
| None | b7a1d2b9101496921b08579fbee988d014345aef2f5bd660d1f8c7332d81560e |
| turbo-cache-control | no-preview |
| go-import | github.com/getsentry/sentry-javascript git https://github.com/getsentry/sentry-javascript.git |
| octolytics-dimension-user_id | 1396951 |
| octolytics-dimension-user_login | getsentry |
| octolytics-dimension-repository_id | 3328572 |
| octolytics-dimension-repository_nwo | getsentry/sentry-javascript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3328572 |
| octolytics-dimension-repository_network_root_nwo | getsentry/sentry-javascript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | c3dd496c3da6ea6b77e69c09279d2b81604654f1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width