diff --git a/packages/nextjs/src/common/wrapApiHandlerWithSentry.ts b/packages/nextjs/src/common/wrapApiHandlerWithSentry.ts index cf4e92627406..d1b51b6fc36e 100644 --- a/packages/nextjs/src/common/wrapApiHandlerWithSentry.ts +++ b/packages/nextjs/src/common/wrapApiHandlerWithSentry.ts @@ -2,6 +2,7 @@ import { addTracingExtensions, captureException, continueTrace, + getCurrentScope, runWithAsyncContext, startSpanManual, } from '@sentry/core'; @@ -112,6 +113,8 @@ export function withSentry(apiHandler: NextApiHandler, parameterizedRoute?: stri }, }, async span => { + getCurrentScope().setSDKProcessingMetadata({ request: req }); + // eslint-disable-next-line @typescript-eslint/unbound-method res.end = new Proxy(res.end, { apply(target, thisArg, argArray) {