Fix Sentry instrumentation server-side (#2690)

This commit is contained in:
Greg Bergé
2025-01-08 09:52:02 +01:00
committed by GitHub
parent c1e27ccacc
commit 5112e3e79b
3 changed files with 6 additions and 28 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'gitbook': patch
---
Fix Sentry instrumentation server-side
+1 -7
View File
@@ -1,13 +1,7 @@
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');
}
await import('./sentry.edge.config');
}
export const onRequestError = Sentry.captureRequestError;
-21
View File
@@ -1,21 +0,0 @@
import { init } from '@sentry/nextjs';
const dsn = process.env.SENTRY_DSN;
if (dsn) {
init({
debug: false,
dsn,
release: process.env.SENTRY_RELEASE,
sampleRate: 0.1,
// Disable tracing as it creates additional requests in an env where subrequests are limited.
enableTracing: false,
// Disable transactions as it creates additional requests in an env where subrequests are limited.
// https://docs.sentry.io/platforms/node/configuration/filtering/#using--3
beforeSendTransaction: () => {
return null;
},
});
}