Skip to content

Commit 3dd5b3a

Browse files
committed
fix: still set the trasnaction name
1 parent f687f59 commit 3dd5b3a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

packages/nextjs/src/common/wrapMiddlewareWithSentry.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { captureException, handleCallbackErrors } from '@sentry/core';
1+
import { captureException, getCurrentScope, handleCallbackErrors } from '@sentry/core';
22
import { flushSafelyWithTimeout, waitUntil } from '../common/utils/responseEnd';
33
import type { EdgeRouteHandler } from '../edge/types';
44

@@ -40,6 +40,10 @@ export function wrapMiddlewareWithSentry<H extends EdgeRouteHandler>(
4040
}
4141
}
4242

43+
const req: unknown = args[0];
44+
const spanName = req instanceof Request ? `middleware ${req.method}` : 'middleware';
45+
getCurrentScope().setTransactionName(spanName);
46+
4347
return handleCallbackErrors(
4448
() => wrappingTarget.apply(thisArg, args),
4549
error => {

0 commit comments

Comments
 (0)