Files
klz-cables.com/instrumentation.ts
Marc Mintel d6c1d6bae6
Some checks failed
Build & Deploy KLZ Cables / build-and-deploy (push) Failing after 4m2s
env
2026-01-28 15:06:21 +01:00

28 lines
927 B
TypeScript

import * as Sentry from '@sentry/nextjs';
/**
* Next.js will call this on boot for the active runtime.
*
* NEXT_RUNTIME is an environment variable automatically set by Next.js:
* - 'nodejs' when running in the standard Node.js runtime
* - 'edge' when running in the Edge runtime (e.g. Middleware, Edge API Routes)
*/
export async function register() {
if (process.env.NEXT_RUNTIME === 'nodejs') {
await import('./sentry.server.config');
// Initialize server services on boot
// We do this AFTER Sentry to ensure errors during service init are caught
const { getServerAppServices } = await import('@/lib/services/create-services.server');
getServerAppServices();
}
if (process.env.NEXT_RUNTIME === 'edge') {
await import('./sentry.edge.config');
}
}
// Capture errors from Server Components, middleware and route handlers.
export const onRequestError = Sentry.captureRequestError;