3030
3131import { debug } from '../../utils/debug-logger' ;
3232import { captureException } from '../../exports' ;
33- import { getIsolationScope } from '../../currentScopes' ;
34- import { httpRequestToRequestData } from '../../utils/request' ;
3533import { DEBUG_BUILD } from '../../debug-build' ;
3634import type {
3735 ExpressApplication ,
@@ -58,6 +56,7 @@ import {
5856} from './utils' ;
5957import { wrapMethod } from '../../utils/object' ;
6058import { patchLayer } from './patch-layer' ;
59+ import { setSDKProcessingMetadata } from './set-sdk-processing-metadata' ;
6160
6261const getExpressExport = ( express : ExpressModuleExport ) : ExpressExport =>
6362 hasDefaultProp ( express ) ? express . default : ( express as ExpressExport ) ;
@@ -166,11 +165,8 @@ export function expressErrorHandler(options?: ExpressHandlerOptions): ExpressErr
166165 res : ExpressResponse ,
167166 next : ( error : MiddlewareError ) => void ,
168167 ) : void {
169- const normalizedRequest = httpRequestToRequestData ( request ) ;
170- // Ensure we use the express-enhanced request here, instead of the plain HTTP one
171168 // When an error happens, the `expressRequestHandler` middleware does not run, so we set it here too
172- getIsolationScope ( ) . setSDKProcessingMetadata ( { normalizedRequest } ) ;
173-
169+ setSDKProcessingMetadata ( request ) ;
174170 const shouldHandleError = options ?. shouldHandleError || defaultShouldHandleError ;
175171
176172 if ( shouldHandleError ( error ) ) {
@@ -223,10 +219,7 @@ export function setupExpressErrorHandler(
223219
224220function expressRequestHandler ( ) : ExpressMiddleware {
225221 return function sentryRequestMiddleware ( request : ExpressRequest , _res : ExpressResponse , next : ( ) => void ) : void {
226- const normalizedRequest = httpRequestToRequestData ( request ) ;
227- // Ensure we use the express-enhanced request here, instead of the plain HTTP one
228- getIsolationScope ( ) . setSDKProcessingMetadata ( { normalizedRequest } ) ;
229-
222+ setSDKProcessingMetadata ( request ) ;
230223 next ( ) ;
231224 } ;
232225}
0 commit comments