We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f687f59 commit 3dd5b3aCopy full SHA for 3dd5b3a
packages/nextjs/src/common/wrapMiddlewareWithSentry.ts
@@ -1,4 +1,4 @@
1
-import { captureException, handleCallbackErrors } from '@sentry/core';
+import { captureException, getCurrentScope, handleCallbackErrors } from '@sentry/core';
2
import { flushSafelyWithTimeout, waitUntil } from '../common/utils/responseEnd';
3
import type { EdgeRouteHandler } from '../edge/types';
4
@@ -40,6 +40,10 @@ export function wrapMiddlewareWithSentry<H extends EdgeRouteHandler>(
40
}
41
42
43
+ const req: unknown = args[0];
44
+ const spanName = req instanceof Request ? `middleware ${req.method}` : 'middleware';
45
+ getCurrentScope().setTransactionName(spanName);
46
+
47
return handleCallbackErrors(
48
() => wrappingTarget.apply(thisArg, args),
49
error => {
0 commit comments