@@ -66,6 +66,11 @@ export function tracingHandler(): (
66
66
...traceparentData ,
67
67
metadata : {
68
68
dynamicSamplingContext : traceparentData && ! dynamicSamplingContext ? { } : dynamicSamplingContext ,
69
+ // The request should already have been stored in `scope.sdkProcessingMetadata` (which will become
70
+ // `event.sdkProcessingMetadata` the same way the metadata here will) by `sentryRequestMiddleware`, but on the
71
+ // off chance someone is using `sentryTracingMiddleware` without `sentryRequestMiddleware`, it doesn't hurt to
72
+ // be sure
73
+ request : req ,
69
74
source,
70
75
} ,
71
76
} ,
@@ -162,6 +167,8 @@ export function requestHandler(
162
167
163
168
currentHub . configureScope ( scope => {
164
169
scope . addEventProcessor ( backwardsCompatibleEventProcessor ) ;
170
+ scope . setSDKProcessingMetadata ( { request : req } ) ;
171
+
165
172
const client = currentHub . getClient < NodeClient > ( ) ;
166
173
if ( isAutoSessionTrackingEnabled ( client ) ) {
167
174
const scope = currentHub . getScope ( ) ;
@@ -240,6 +247,11 @@ export function errorHandler(options?: {
240
247
241
248
if ( shouldHandleError ( error ) ) {
242
249
withScope ( _scope => {
250
+ // The request should already have been stored in `scope.sdkProcessingMetadata` by `sentryRequestMiddleware`,
251
+ // but on the off chance someone is using `sentryErrorMiddleware` without `sentryRequestMiddleware`, it doesn't
252
+ // hurt to be sure
253
+ _scope . setSDKProcessingMetadata ( { request : _req } ) ;
254
+
243
255
// For some reason we need to set the transaction on the scope again
244
256
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
245
257
const transaction = ( res as any ) . __sentry_transaction as Span ;
0 commit comments