Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions packages/nextjs/src/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
getIsolationScope,
getRootSpan,
GLOBAL_OBJ,
hasSpansEnabled,
SEMANTIC_ATTRIBUTE_SENTRY_OP,
SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,
SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,
Expand Down Expand Up @@ -106,9 +107,12 @@ export function init(options: NodeOptions): NodeClient | undefined {
}),
);

// Turn off Next.js' own fetch instrumentation
// Turn off Next.js' own fetch instrumentation (only when Sentry spans are enabled, and we manage OTEL)
// https://github.com/lforst/nextjs-fork/blob/1994fd186defda77ad971c36dc3163db263c993f/packages/next/src/server/lib/patch-fetch.ts#L245
process.env.NEXT_OTEL_FETCH_DISABLED = '1';
// Enable with custom OTel setup: https://github.com/getsentry/sentry-javascript/issues/17581
if (hasSpansEnabled(options) && !options.skipOpenTelemetrySetup) {
process.env.NEXT_OTEL_FETCH_DISABLED = '1';
}

// This value is injected at build time, based on the output directory specified in the build config. Though a default
// is set there, we set it here as well, just in case something has gone wrong with the injection.
Expand Down