Files
pn-new-crm/instrumentation.ts

21 lines
620 B
TypeScript
Raw Normal View History

/**
* Next.js instrumentation hook (Next 13.4+ / 15+ / 16+).
*
* Runs once at server startup. We use it to wire Sentry's server +
* edge runtimes. The client init is auto-bundled by withSentryConfig
* from `sentry.client.config.ts`.
*
* The Sentry imports are gated behind the DSN check so the SDK stays
* a no-op when unconfigured.
*/
export async function register() {
if (!process.env.NEXT_PUBLIC_SENTRY_DSN) return;
if (process.env.NEXT_RUNTIME === 'nodejs') {
await import('./sentry.server.config');
}
if (process.env.NEXT_RUNTIME === 'edge') {
await import('./sentry.edge.config');
}
}