How to use the @sentry/integrations.RewriteFrames function in @sentry/integrations

To help you get started, we’ve selected a few @sentry/integrations 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 pavjacko / renative / packages / rnv / src / systemTools / analytics.js View on Github external
initialize() {
        if (Config.isAnalyticsEnabled) {
            // ERROR HANDLING
            // eslint-disable-next-line global-require
            this.errorFixer = require('@sentry/node');

            this.errorFixer.init({
                dsn: 'https://004caee3caa04c81a10f2ba31a945362@sentry.io/1795473',
                release: `rnv@${pkg.version}`,
                integrations: [new RewriteFrames({
                    root: '/',
                    iteratee: (frame) => {
                        if (frame.filename.includes(`rnv${path.sep}dist${path.sep}`) || frame.filename.includes(`rnv${path.sep}src${path.sep}`)) {
                            if (frame.filename.includes(`rnv${path.sep}dist${path.sep}`)) {
                                frame.filename = frame.filename.split(`rnv${path.sep}dist${path.sep}`)[1];
                            } else {
                                frame.filename = frame.filename.split(`rnv${path.sep}src${path.sep}`)[1];
                            }
                        } else if (frame.filename.includes(`${path.sep}node_modules${path.sep}`)) {
                            frame.filename = `node_modules/${frame.filename.split(`${path.sep}node_modules${path.sep}`)[1]}`;
                        }
                        return frame;
                    }
                })]
            });
github getsentry / sentry-react-native / src / js / sdk.ts View on Github external
}
): void {
  // tslint:disable: strict-comparisons
  if (options.defaultIntegrations === undefined) {
    options.defaultIntegrations = [
      new ReactNativeErrorHandlers(),
      new Release(),
      ...defaultIntegrations.filter(
        i => !IGNORED_DEFAULT_INTEGRATIONS.includes(i.name)
      ),
      new Integrations.Breadcrumbs({
        console: false, // If this in enabled it causes problems to native calls on >= RN 0.60
        fetch: false
      }),
      new DebugSymbolicator(),
      new RewriteFrames({
        iteratee: (frame: StackFrame) => {
          if (frame.filename) {
            frame.filename = frame.filename
              .replace(/^file\:\/\//, "")
              .replace(/^address at /, "")
              .replace(/^.*\/[^\.]+(\.app|CodePush|.*(?=\/))/, "");

            const appPrefix = "app://";
            // We always want to have a tripple slash
            frame.filename =
              frame.filename.indexOf("/") === 0
                ? `${appPrefix}${frame.filename}`
                : `${appPrefix}/${frame.filename}`;
          }
          return frame;
        }
github Radarr / Radarr / frontend / src / Store / Middleware / createSentryMiddleware.js View on Github external
if (!analytics) {
    return;
  }

  const dsn = isProduction ? 'https://b0fb75c38ef4487dbf742f79c4ba62d2@sentry.servarr.com/12' :
    'https://da610619280249f891ec3ee306906793@sentry.servarr.com/13';

  sentry.init({
    dsn,
    environment: branch,
    release,
    sendDefaultPii: true,
    beforeSend: cleanseData,
    integrations: [
      new Integrations.RewriteFrames({ iteratee: stripUrlBase }),
      new Integrations.Dedupe()
    ]
  });

  sentry.configureScope((scope) => {
    scope.setUser({ username: userHash });
    scope.setTag('version', version);
    scope.setTag('production', isProduction);
  });

  return createMiddleware();
}
github astroband / astrograph / src / init.ts View on Github external
export default async function init(): Promise {
  if (secrets.SENTRY_DSN) {
    Sentry.init({
      dsn: secrets.SENTRY_DSN,
      integrations: [new Integrations.RewriteFrames({ root: __dirname || process.cwd() })]
    });
  }

  const network = setStellarNetwork();
  logger.info(`Using ${network}`);

  logger.info("Connecting to database...");
  await createConnection({
    type: "postgres",
    host: secrets.DBHOST,
    port: secrets.DBPORT,
    username: secrets.DBUSER,
    password: secrets.DBPASSWORD,
    database: secrets.DB,
    entities: ["./src/orm/entities/*.ts"],
    synchronize: false,
github astroband / astrograph / src / init / sentry.ts View on Github external
export function initSentry(): Promise {
  if (!SENTRY_DSN) {
    return Promise.resolve(false);
  }

  Sentry.init({
    dsn: SENTRY_DSN,
    integrations: [
      new Integrations.RewriteFrames({
        root: __dirname ? `${__dirname}/../..` : process.cwd()
      })
    ]
  });

  return Promise.resolve(true);
}