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/browser
-
@sentry/node
-
raven-js
-
raven-node
(raven for node) - other:
Version:
5.9.1
Description
I followed instruction how to use Sentry Client directly: https://github.com/getsentry/sentry-docs/blob/master/src/collections/_documentation/platforms/javascript/advance-settings.md.
My Sentry initialization looks like this:
const options = {
dsn: "MY_SENTRY_DSN",
release: "x.x.x",
environment: "production",
integrations: [...Sentry.defaultIntegrations],
};
const client = new Sentry.BrowserClient(options);
this.hub = new Sentry.Hub(client);
...
...
// later in code
this.hub.captureMessage("Hello");
Bug
Integrations don't work, they don't enhance event
Reason
– On every event, integration's globalEventProcessor called (e.g UserAgent integration): source code
– Sentry looks if current hub has integration (e.g UserAgent): source code
– Sentry looks for current hub: source code
– Sentry checks if there is window.__SENTRY__.hub
and fails: source code
– Sentry creates new hub without client passed as parameter to Hub constructor: source code
– hub.getIntegration
method returns null cause there is no client: source code
– integration skipped cause hub doesn't have current integration :(