question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Integrations don't work when using Sentry Client directly

See original GitHub issue

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 codehub.getIntegration method returns null cause there is no client: source code – integration skipped cause hub doesn’t have current integration 😦

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
rhcarvalhocommented, Mar 13, 2020

Closing as this seems to be solved.

1reaction
kamilogorekcommented, Nov 29, 2019

That is correct. In order for global handlers to work with integrations as well, there has to be initialized global instance as well.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting for JavaScript - Sentry Documentation
Integrations are setup on the Client , if you need to deal with multiple clients and hubs you have to make sure to...
Read more >
Troubleshooting for Cordova - Sentry Documentation
Integrations are setup on the Client , if you need to deal with multiple clients and hubs you have to make sure to...
Read more >
Advanced Usage - Docs - Sentry Documentation
Using a Client directly ... To be able to manage several Sentry instances without any conflicts between them you need to create your...
Read more >
Sentry Integration - Docs - PostHog
Make sure you're using both PostHog and Sentry as JS modules. You'll need to replace 'your organization' and project-id with the organization and...
Read more >
Sentry Integration - Linear
How it works ... After enabling this integration, an option to create or link Linear issues will appear in the right sidebar when...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found