Skip to content

Commit 04c2b04

Browse files
committed
fix: Set transaction on scope in node for request
1 parent aa60eea commit 04c2b04

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

packages/node/src/handlers.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,11 @@ export function errorHandler(options?: {
407407

408408
if (shouldHandleError(error)) {
409409
withScope(_scope => {
410+
// For some reason we need to set the transaction on the scope again
411+
const transaction = (res as any).__sentry_transaction as Span;
412+
if (transaction && _scope.getSpan() === undefined) {
413+
_scope.setSpan(transaction);
414+
}
410415
const eventId = captureException(error);
411416
(res as any).sentry = eventId;
412417
next(error);

0 commit comments

Comments
 (0)