@@ -113,7 +113,11 @@ export function sentryHandle(handlerOptions?: SentryHandleOptions): Handle {
113113 // We only call continueTrace in the initial top level request to avoid
114114 // creating a new root span for the sub request.
115115 isolationScope . setSDKProcessingMetadata ( {
116- normalizedRequest : winterCGRequestToRequestData ( input . event . request . clone ( ) ) ,
116+ // We specifically avoid cloning the request here to avoid double read errors.
117+ // We only read request headers so we're not consuming the body anyway.
118+ // Note to future readers: This sounds counter-intuitive but please read
119+ // https://github.com/getsentry/sentry-javascript/issues/14583
120+ normalizedRequest : winterCGRequestToRequestData ( input . event . request ) ,
117121 } ) ;
118122 return continueTrace ( getTracePropagationData ( input . event ) , ( ) => instrumentHandle ( input , options ) ) ;
119123 } ) ;
@@ -163,7 +167,11 @@ async function instrumentHandle(
163167 } ,
164168 async ( span ?: Span ) => {
165169 getCurrentScope ( ) . setSDKProcessingMetadata ( {
166- normalizedRequest : winterCGRequestToRequestData ( event . request . clone ( ) ) ,
170+ // We specifically avoid cloning the request here to avoid double read errors.
171+ // We only read request headers so we're not consuming the body anyway.
172+ // Note to future readers: This sounds counter-intuitive but please read
173+ // https://github.com/getsentry/sentry-javascript/issues/14583
174+ normalizedRequest : winterCGRequestToRequestData ( event . request ) ,
167175 } ) ;
168176 const res = await resolve ( event , {
169177 transformPageChunk : addSentryCodeToPage ( { injectFetchProxyScript : options . injectFetchProxyScript ?? true } ) ,
0 commit comments