Skip to content

Commit

Permalink
fix(remix): Store transaction on express req (#5595)
Browse files Browse the repository at this point in the history
This sets the transaction on the response so it can be finished.
  • Loading branch information
AbhiPrasad committed Aug 17, 2022
1 parent 8c58e0d commit 8e21f0d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/remix/src/utils/serverAdapters/express.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ function wrapExpressRequestHandler(
}

const url = new URL(request.url);
startRequestHandlerTransaction(url, request.method, routes, hub, pkg);
const transaction = startRequestHandlerTransaction(url, request.method, routes, hub, pkg);
// save a link to the transaction on the response, so that even if there's an error (landing us outside of
// the domain), we can still finish it (albeit possibly missing some scope data)
(res as AugmentedExpressResponse).__sentryTransaction = transaction;
return origRequestHandler.call(this, req, res, next);
};
}
Expand Down

0 comments on commit 8e21f0d

Please sign in to comment.