You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

sentry.ts 886B

1234567891011121314151617181920212223242526272829303132
  1. import * as Sentry from '@sentry/node'
  2. import { RewriteFrames } from '@sentry/integrations'
  3. export const init = () => {
  4. if (process.env.NEXT_PUBLIC_SENTRY_DSN) {
  5. const integrations = []
  6. if (
  7. process.env.NEXT_IS_SERVER === 'true' &&
  8. process.env.NEXT_PUBLIC_SENTRY_SERVER_ROOT_DIR
  9. ) {
  10. integrations.push(
  11. new RewriteFrames({
  12. iteratee: (frame) => {
  13. frame.filename = frame.filename.replace(
  14. process.env.NEXT_PUBLIC_SENTRY_SERVER_ROOT_DIR,
  15. 'app:///'
  16. )
  17. frame.filename = frame.filename.replace('.next', '_next')
  18. return frame
  19. },
  20. })
  21. )
  22. }
  23. Sentry.init({
  24. enabled: process.env.NODE_ENV === 'production',
  25. integrations,
  26. dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
  27. release: process.env.NEXT_PUBLIC_COMMIT_SHA,
  28. })
  29. }
  30. }