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,
})
```
19 lines
305 B
TypeScript
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 {}
|