diff --git a/.changeset/wise-otters-hear.md b/.changeset/wise-otters-hear.md new file mode 100644 index 0000000000..fdb14360de --- /dev/null +++ b/.changeset/wise-otters-hear.md @@ -0,0 +1,5 @@ +--- +'gitbook': patch +--- + +Fix Sentry instrumentation server-side diff --git a/packages/gitbook/instrumentation.ts b/packages/gitbook/instrumentation.ts index 89f2eafdc6..4b220018d3 100644 --- a/packages/gitbook/instrumentation.ts +++ b/packages/gitbook/instrumentation.ts @@ -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; diff --git a/packages/gitbook/sentry.server.config.ts b/packages/gitbook/sentry.server.config.ts deleted file mode 100644 index b499d12899..0000000000 --- a/packages/gitbook/sentry.server.config.ts +++ /dev/null @@ -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; - }, - }); -}