sentry.server.config.js 760 B

12345678910111213141516171819
  1. // This file configures the initialization of Sentry on the server.
  2. // The config you add here will be used whenever the server handles a request.
  3. // https://docs.sentry.io/platforms/javascript/guides/nextjs/
  4. import * as Sentry from '@sentry/nextjs';
  5. const SENTRY_DSN = process.env.SENTRY_DSN || process.env.NEXT_PUBLIC_SENTRY_DSN;
  6. const SENTRY_ENABLED = process.env.NEXT_PUBLIC_SERVER_SENTRY_ENABLED === 'true';
  7. const isDev = process.env.NODE_ENV === 'development';
  8. Sentry.init({
  9. enabled: SENTRY_ENABLED,
  10. dsn: SENTRY_ENABLED ? SENTRY_DSN : null,
  11. // Set tracesSampleRate to 1.0 to capture 100%
  12. // of transactions for performance monitoring.
  13. // We recommend adjusting this value in production
  14. tracesSampleRate: isDev ? 1 : 0,
  15. debug: isDev,
  16. });