Title: Integrations don't work when using Sentry Client directly · Issue #2329 · getsentry/sentry-javascript · GitHub
Open Graph Title: Integrations don't work when using Sentry Client directly · Issue #2329 · getsentry/sentry-javascript
X Title: Integrations don't work when using Sentry Client directly · Issue #2329 · 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 Package + Version @sentry...
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/2329
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Integrations don't work when using Sentry Client directly","articleBody":"- [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\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\n5.9.1\r\n```\r\n\r\n## Description\r\n\r\nI followed instruction how to use Sentry Client directly: https://github.com/getsentry/sentry-docs/blob/master/src/collections/_documentation/platforms/javascript/advance-settings.md.\r\n\r\nMy Sentry initialization looks like this:\r\n\r\n```javascript\r\n const options = {\r\n dsn: \"MY_SENTRY_DSN\",\r\n release: \"x.x.x\",\r\n environment: \"production\",\r\n integrations: [...Sentry.defaultIntegrations],\r\n };\r\n const client = new Sentry.BrowserClient(options);\r\n this.hub = new Sentry.Hub(client);\r\n ...\r\n ...\r\n // later in code\r\n this.hub.captureMessage(\"Hello\");\r\n```\r\n\r\n**Bug**\r\nIntegrations don't work, they don't enhance event\r\n\r\n**Reason**\r\n– On every event, integration's globalEventProcessor called (e.g UserAgent integration): [source code](https://github.com/getsentry/sentry-javascript/blob/master/packages/browser/src/integrations/useragent.ts#L23)\r\n– Sentry looks if current hub has integration (e.g UserAgent): [source code](https://github.com/getsentry/sentry-javascript/blob/master/packages/browser/src/integrations/useragent.ts#L24)\r\n– Sentry looks for current hub: [source code](https://github.com/getsentry/sentry-javascript/blob/4905a844cef67fbd0347ee6e6f0da584f013a091/packages/hub/src/hub.ts#L416)\r\n– Sentry checks if there is `window.__SENTRY__.hub`and fails: [source code](https://github.com/getsentry/sentry-javascript/blob/4905a844cef67fbd0347ee6e6f0da584f013a091/packages/hub/src/hub.ts#L421)\r\n– Sentry creates new hub without client passed as parameter to Hub constructor: [source code](https://github.com/getsentry/sentry-javascript/blob/4905a844cef67fbd0347ee6e6f0da584f013a091/packages/hub/src/hub.ts#L422)\r\n– `hub.getIntegration` method returns null cause there is no client: [source code](https://github.com/getsentry/sentry-javascript/blob/4905a844cef67fbd0347ee6e6f0da584f013a091/packages/hub/src/hub.ts#L360)\r\n– integration skipped cause hub doesn't have current integration :(","author":{"url":"https://github.com/akaSybe","@type":"Person","name":"akaSybe"},"datePublished":"2019-11-28T16:54:41Z","url":"https://github.com/getsentry/sentry-javascript/issues/2329"}
| 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:e68786a9-3daf-1ad7-cdd5-2022a0035944 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EA38:1C8FCC:40DDA6:57CFE7:6B044174 |
| html-safe-nonce | db91bbd55865c05b05a9750220728b6a23f6869227e5876c58c116593890d90c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQTM4OjFDOEZDQzo0MEREQTY6NTdDRkU3OjZCMDQ0MTc0IiwidmlzaXRvcl9pZCI6IjE0ODM4MzEyNjg5MjcwOTUxNTYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | bf1d986f37949c3ee83736fd7e39d8471110ff8e46873cb2a8a41134bfec88b1 |
| hovercard-subject-tag | issue:530012496 |
| 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/2329/issue_layout |
| twitter:image | https://opengraph.githubassets.com/1513087fa40801a6055867477d23696aaff79b240f3c52dd661a4d9061b95454/getsentry/sentry-javascript/issues/2329 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/1513087fa40801a6055867477d23696aaff79b240f3c52dd661a4d9061b95454/getsentry/sentry-javascript/issues/2329 |
| 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 | akaSybe |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9185ccfefd80c1ff2d9ddcdb0cd2becf46b5a1efbbf30741a895e4bb8de25e64 |
| 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 | 06dc448a76fe4751ac1db26524aefa3aa3e889a8 |
| 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