Skip to content

Integrations don't work when using Sentry Client directly #2329

Closed
@akaSybe

Description

@akaSybe

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__.huband 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 :(

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions