Skip to content

Commit 39795a8

Browse files
committed
revert changing command
1 parent d039640 commit 39795a8

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

packages/nextjs/src/server/index.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {
1818
getIsolationScope,
1919
getRootSpan,
2020
GLOBAL_OBJ,
21+
hasSpansEnabled,
2122
SEMANTIC_ATTRIBUTE_SENTRY_OP,
2223
SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,
2324
SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,
@@ -106,9 +107,12 @@ export function init(options: NodeOptions): NodeClient | undefined {
106107
}),
107108
);
108109

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

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

0 commit comments

Comments
 (0)