Sentry est actif uniquement en production (DSN absent en dev → SDK inerte). Capture automatique des erreurs Server Components, server actions, middleware (via onRequestError) et côté client (error boundary global).
12 lines
321 B
TypeScript
12 lines
321 B
TypeScript
import * as Sentry from '@sentry/nextjs'
|
|
|
|
export async function register() {
|
|
if (process.env.NEXT_RUNTIME === 'nodejs') {
|
|
await import('./sentry.server.config')
|
|
}
|
|
if (process.env.NEXT_RUNTIME === 'edge') {
|
|
await import('./sentry.edge.config')
|
|
}
|
|
}
|
|
|
|
export const onRequestError = Sentry.captureRequestError
|