sentry-javascript: @sentry/browser no-conflict mode

Package + Version

  • @sentry/browser
  • @sentry/node
  • raven-js
  • raven-node (raven for node)
  • other:

Version:

4.0.6

Description

App that I am working on uses @sentry/browser SDK and was installed based on the documentation. The problem is that app can be integrated into other apps which have Sentry as well, so I will get conflicts. I didn’t find any information about no-conflict mode like it is implemented in Raven.js. The question is - does @sentry/browser SDK supports no-conflict mode like “Sentry.noConflict()” and if so how can I execute it?

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 16 (6 by maintainers)

Most upvoted comments

We also are having a similar issue where our React App is hosted as a super-widget inside a larger app that also uses Sentry. However we need to automatically capture and send our errors to our own separate DSN. I will try @chocking solution above, but would appreciate any additional help anyone could provide. Thanks!

I think what you really want to do is, instead of calling init you want to probably create your own Client and send off your captured errors to your Sentry installation. If you call init we hook into a lot of global hooks, (error handler, unhandled promises, breadcrumbs) you would receive all event from the parent application which is on one hand a security concern and on the other hand it sends errors to you that may not be related in any form to your app.

Creating your own Client works the same as with init

import * as Sentry from '@sentry/browser';

const client = new Sentry.BrowserClient({
  dsn: 'DSN',
});

//

client.captureException(new Error('bla'));

Is that what you actually want?