How to use the @sentry/browser.init function in @sentry/browser

To help you get started, we’ve selected a few @sentry/browser examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github edbzn / reactive-blog / packages / client / src / app / core / services / error-handler-service.ts View on Github external
constructor() {
    if (process.env.NODE_ENV === 'production') {
      Sentry.init({
        dsn: process.env.SENTRY_DSN,
        integrations: [
          new Sentry.Integrations.Breadcrumbs({
            console: true, // Log calls to `console.log`, `console.debug`, etc
            dom: true, // Log all click and keypress events
            fetch: true, // Log HTTP requests done with the Fetch API
            history: true, // Log calls to `history.pushState` and friends
            sentry: true, // Log whenever we send an event to the server
            xhr: true, // Log HTTP requests done with the XHR API
          }),
        ],
      });
    }
  }
github hypothesis / client / src / sidebar / util / sentry.js View on Github external
function init(config) {
  // Only send events for errors which can be attributed to our code. This
  // reduces noise in Sentry caused by errors triggered by eg. script tags added
  // by browser extensions. The downside is that this may cause us to miss errors
  // which are caused by our code but, for any reason, cannot be attributed to
  // it. This logic assumes that all of our script bundles are served from
  // the same origin as the bundle which includes this module.
  //
  // If we can't determine the current script's origin, just disable the
  // whitelist and report all errors.
  const scriptOrigin = currentScriptOrigin();
  const whitelistUrls = scriptOrigin ? [scriptOrigin] : null;

  Sentry.init({
    dsn: config.dsn,
    environment: config.environment,
    release: '__VERSION__', // replaced by versionify
    whitelistUrls,

    // See https://docs.sentry.io/error-reporting/configuration/filtering/?platform=javascript#before-send
    beforeSend: (event, hint) => {
      if (eventsSent >= maxEventsToSendPerSession) {
        // Cap the number of events that any client instance will send, to
        // reduce the impact on our Sentry event quotas.
        //
        // Sentry implements its own server-side rate limiting in addition.
        // See https://docs.sentry.io/accounts/quotas/.
        warnOnce(
          'Client-side Sentry quota reached. No further Sentry events will be sent'
        );
github wulkano / kap / renderer / pages / _app.js View on Github external
constructor(...args) {
    super(...args);

    if (remote) {
      // TODO: When we disable SSR, this can be a normal import
      const {is, darkMode} = remote.require('electron-util');
      const settings = remote.require('./common/settings');

      if (!is.development && settings.get('allowAnalytics')) {
        Sentry.init({dsn: SENTRY_PUBLIC_DSN});
      }

      this.darkMode = darkMode;
    }
  }
github taskcluster / taskcluster / ui / src / App / index.jsx View on Github external
theme: theme.darkTheme,
      auth: {
        user: null,
        authorize: this.authorize,
        unauthorize: this.unauthorize,
      },
    };

    if (window.env.GA_TRACKING_ID) {
      // Unique Google Analytics tracking number
      ReactGA.initialize(`UA-${window.env.GA_TRACKING_ID}`);
    }

    if (window.env.SENTRY_DSN) {
      // Data Source Name (DSN), a configuration required by the Sentry SDK
      initSentry({ dsn: window.env.SENTRY_DSN });
    }

    this.state = state;
  }
github allegro / turnilo / src / client / utils / error-reporter / error-reporter.ts View on Github external
export function init(dsn: string, release: string) {
  initSentry({ dsn, release });
  isInitialised = true;
}
github OriginProtocol / origin / dapps / marketplace / src / utils / sentry.js View on Github external
export function initSentry() {
  Sentry.init({
    dsn: process.env.SENTRY_DSN,
    release: `marketplace-dapp@${process.env.GIT_COMMIT_HASH}`,
    environment: getEnvName()
  })
  Sentry.configureScope(scope => {
    scope.setTag(
      'isWebView',
      typeof window !== 'undefined' &&
        typeof window.ReactNativeWebView !== 'undefined'
    )
    scope.setTag(
      'isOrigin',
      typeof window !== 'undefined' &&
        typeof window.web3 !== 'undefined' &&
        typeof window.web3.providers !== 'undefined' &&
        window.web3.providers.length > 0 &&
github brianlovin / security-checklist / pages / _app.js View on Github external
componentDidMount() {
    Sentry.init({
      dsn: 'https://b92b29b696884e5798e161962eac36de@sentry.io/1318151',
    });
  }
github mozilla / foundation.mozilla.org / source / js / common / sentry-config.js View on Github external
function initializeSentry(dsn, release, environment) {
  Sentry.init({
    dsn,
    release,
    environment,
    ignoreErrors: [
      "tgetT is not defined",
      "Unexpected token 'else'",
      "Object doesn't support property or method 'forEach'",
      /Cannot redefine non-configurable property '[a-zA-Z\d_]+'/,
      /^An invalid or illegal selector was specified.+$/,
    ],
  });
}
github mozilla / voice-web / web / src / components / app.tsx View on Github external
if (isNativeIOS()) {
      this.bootstrapIOS();
    }

    if (isFirefoxFocus()) {
      document.body.classList.add('focus');
    }

    if (isMobileWebkit()) {
      document.body.classList.add('mobile-safari');
    }

    this.userLocales = negotiateLocales(navigator.languages);

    Sentry.init({
      dsn:
        'https://4a940c31e4e14d8fa6984e919a56b9fa@sentry.prod.mozaws.net/491',
      environment: isProduction() ? 'prod' : 'stage',
      release: process.env.GIT_COMMIT_SHA || null,
    });
  }