-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Directly instantiated Hub+Client don't use integrations/send integration data #1764
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
Hey, so here is a working example: Hope this helps. The thing that's missing is to make your I am closing this if you are still having troubles let me know. |
Thanks for the info! Is the way Hubs work explained the docs somewhere? I'm concerned that using a "global" Hub may undo the point of using a custom Client; namely being able to send different events to different DSNs within the same web app. The instructions here https://docs.sentry.io/platforms/javascript/advance-settings/ say that this is the way "to be able to manage several Sentry instances without any conflicts between them", and they suggest creating your own Hub rather than using the global one. Is using the global Hub with a custom Client still safe for use in a context where multiple Sentry instances are active within the same webapp? These are all within the same organization so it's "safe" if info like breadcrumbs "leak" between them, and of course any exception that bubbles up to the top level unhandled will go to whatever is the default, but can different teams within one org send exceptions to different DSNs using this mechanism? Apologies if this is all in the docs somewhere; I scoured them pretty extensively but couldn't find details on this use case. Thanks again for your help! |
@kamilogorek @felixc @HazAT thank you all for this - I had the very same issue today. |
@HazAT Hi Daniel want to bump this thread, we want to use sentry in the context of our own library so ability to having separate sentry client while leveraging integration such as UserAgent would be great |
It looks like this has been an issue for a couple of years now without any resolution. It would be very helpful to have concrete guidance on how exactly to have multiple Hub / Client instances of Sentry running on a single web page that can each automatically log all unhandled exceptions for only their issues to their own DSN. |
Here is a doc link that I've found useful regarding this issue https://docs.sentry.io/platforms/javascript/troubleshooting/#using-a-client-directly . |
@vsashyn the doc you shared is great, thank you, however I'm still unclear on how this is meant to work without imperatively calling For the record, calling Any help would be much appreciated, thanks! |
I just ended up using the example above. We have a single spa application which has a top level instance of sentry then for each micro app we need another instance. I just used this approach but honestly it seems a bit hacky and i'm not 100% sure why this is needed. https://codesandbox.io/s/z3wyllkpq4?file=/src/index.js. |
Uh oh!
There was an error while loading. Please reload this page.
Package + Version
@sentry/browser
- 4.3.4@sentry/node
- N/Araven-js
- N/Araven-node
(raven for node) - N/AVersion:
Description
When directly instantiating a Client and Hub following the instructions in https://docs.sentry.io/platforms/javascript/advance-settings/, the events reported do not show (in the web UI) any of the default integration data. For example, there are no breadcrumbs and no user-agent information.
Specifically, reporting events like this:
...produces events that in the web UI that have the basic exception info, but no breadcrumbs or user-agent info.
On the other hand, using the same DSN and reporting the same exception, but configured like this:
...all the integration data is there.
Adding the
debug: true
parameter to the configuration in both cases shows that the custom Hub+Client do not print anything to the console about integrations being used, while the second (global) case does print the default list of integrations.I also tried importing
defaultIntegrations
and passingintegrations: defaultIntegrations
when instantiating theBrowserClient
, but it didn't change anything.Any pointers would be greatly appreciated!
The text was updated successfully, but these errors were encountered: