This commit is contained in:
phaichayon
2026-06-11 12:46:57 +07:00
parent 1993d88306
commit 7a390cf0df
720 changed files with 100919 additions and 0 deletions

34
src/instrumentation.ts Normal file
View File

@@ -0,0 +1,34 @@
import * as Sentry from '@sentry/nextjs';
const sentryOptions: Sentry.NodeOptions | Sentry.EdgeOptions = {
// Sentry DSN
dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
// Enable Spotlight in development
spotlight: process.env.NODE_ENV === 'development',
// Adds request headers and IP for users, for more info visit
sendDefaultPii: true,
// Adjust this value in production, or use tracesSampler for greater control
tracesSampleRate: 1,
// Setting this option to true will print useful information to the console while you're setting up Sentry.
debug: false
};
export async function register() {
if (!process.env.NEXT_PUBLIC_SENTRY_DISABLED) {
if (process.env.NEXT_RUNTIME === 'nodejs') {
// Node.js Sentry configuration
Sentry.init(sentryOptions);
}
if (process.env.NEXT_RUNTIME === 'edge') {
// Edge Sentry configuration
Sentry.init(sentryOptions);
}
}
}
export const onRequestError = Sentry.captureRequestError;