-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Manually instantiated Hub with provided client instance, shouldn't require additional bindClient call to setup integrations #2541
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
As an aside, I also tried triggering an exception directly from the
This also fails to work with integrations passed to the Client. |
@NicHaley By reading the source code, I found that you need to explicitly call
Alternatively you can call sentry-javascript/packages/hub/src/hub.ts Line 91 in 2efbc98
I also found that the GlobalHandlers integration calls
In general, I think the advance experience of creating your own hub instance it not completely polished and you are pretty much on your own in terms of integrations unfortunately. |
Thanks for the feedback @mcaballeropinto. @NicHaley the comments above are correct. You need to manually bind the client to the new hub as well |
Thanks @mcaballeropinto and @kamilogorek. The above makes sense. I am using the |
Thanks @kamilogorek! I see you want to use this issue to fix having to call
Is this something you will consider looking at? |
We are experiencing a follow-up issue. It seems distinct from this one, so logged it as a new bug: #2622 |
Package + Version
@sentry/browser
@sentry/node
raven-js
raven-node
(raven for node)Version:
Description
As per the Advance Usage docs, I am trying to manage several instances of Sentry. I am developing a widget and would like to use Sentry without it conflicting with the host page.
Creating new instances
BrowserClient
andHub
classes seems to be a great way to do that, but I can't get it to work with my integrations. I found a similar issue #2329, however it was resolved by usinghub.run(...)
. This does not work for me.There was another thread #1764 as well, but the provided solution involves setting the new hub to the current global hub with
getCurrentHub().bindClient(client);
. This works, but it seems to defeat the point of what I'm trying to accomplish since I don't want to modify any globals that might interfere with the host page.My code looks like this:
The text was updated successfully, but these errors were encountered: