Files
payloadcms/sentry.server.config.ts
Sasha 0b2a7a3606 feat(plugin-sentry): update plugin to 3.0 (#8613)
Updates the plugin to 3.0

Test:
```sh
NEXT_PUBLIC_SENTRY_DSN=<DSN here> pnpm dev plugin-sentry
```

Example:
```ts
sentryPlugin({
  options: {
    captureErrors: [400, 403],
    context: ({ defaultContext, req }) => {
      return {
        ...defaultContext,
        tags: {
          locale: req.locale,
        },
      }
    },
    debug: true,
  },
  Sentry,
})
```
2024-10-09 14:26:58 -04:00

19 lines
305 B
TypeScript

import * as Sentry from '@sentry/nextjs'
const dsn = process.env.NEXT_PUBLIC_SENTRY_DSN
const enabled = !!dsn
Sentry.init({
dsn,
enabled,
skipOpenTelemetrySetup: true,
tracesSampleRate: 1.0,
})
if (enabled) {
// eslint-disable-next-line no-console
console.log('Sentry inited')
}
export {}