Skip to content

Commit 2af20e5

Browse files
committed
fix: set the transaction name on the isolation scope level
1 parent c59e752 commit 2af20e5

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

packages/nextjs/src/common/pages-router-instrumentation/wrapApiHandlerWithSentry.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,13 @@ export function wrapApiHandlerWithSentry(apiHandler: NextApiHandler, parameteriz
5050

5151
req.__withSentry_applied__ = true;
5252

53-
// Set transaction name even without tracing to ensure parameterized routes are used
53+
// Set transaction name on isolation scope to ensure parameterized routes are used
54+
// The HTTP server integration sets it on isolation scope, so we need to match that
5455
const method = req.method || 'GET';
55-
getCurrentScope().setTransactionName(`${method} ${parameterizedRoute}`);
56-
56+
const isolationScope = getIsolationScope();
57+
isolationScope.setTransactionName(`${method} ${parameterizedRoute}`);
5758
// Set SDK processing metadata
58-
getIsolationScope().setSDKProcessingMetadata({
59+
isolationScope.setSDKProcessingMetadata({
5960
normalizedRequest: httpRequestToRequestData(req),
6061
});
6162

0 commit comments

Comments
 (0)