Skip to content

Instantly share code, notes, and snippets.

@StErMi
Created April 20, 2021 07:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save StErMi/a883e7a32cc6be9e06ded06a00e8ec51 to your computer and use it in GitHub Desktop.
Save StErMi/a883e7a32cc6be9e06ded06a00e8ec51 to your computer and use it in GitHub Desktop.
Sentry configuration for React app
/* eslint-disable no-process-env */
import * as Sentry from '@sentry/react';
import {Integrations} from '@sentry/tracing';
if (
process.env.REACT_APP_ENVIRONMENT === 'production' ||
process.env.REACT_APP_ENVIRONMENT === 'staging'
) {
Sentry.init({
environment: process.env.REACT_APP_ENVIRONMENT,
release: `${process.env.package_name}@${process.env.package_version}`,
dsn: process.env.REACT_APP_SENTRY_DSN,
integrations: [
new Integrations.BrowserTracing({
tracingOrigins: [process.env.REACT_APP_API_URL as string, /^\//],
}),
],
debug: false,
tracesSampleRate:
process.env.REACT_APP_ENVIRONMENT === 'production' ? 0.2 : 1,
attachStacktrace: true,
ignoreErrors: ['ResizeObserver loop limit exceeded'],
});
} else {
// console.log('SENTRY DISABLED IN DEVELOPMENT ENVIRONMENT');
}
export {};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment