Skip to content

Commit 750e427

Browse files
committed
stop adding request data twice when there's an error, use parseRequest
1 parent 6d287d4 commit 750e427

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

packages/nextjs/src/utils/handlers.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ import { addExceptionMechanism, isString, logger, stripUrlQueryAndFragment } fro
55
import * as domain from 'domain';
66
import { NextApiHandler, NextApiResponse } from 'next';
77

8-
import { addRequestDataToEvent, NextRequest } from './instrumentServer';
9-
108
const { parseRequest } = Handlers;
119

1210
// purely for clarity
@@ -35,7 +33,7 @@ export const withSentry = (handler: NextApiHandler): WrappedNextApiHandler => {
3533
const currentScope = getCurrentHub().getScope();
3634

3735
if (currentScope) {
38-
currentScope.addEventProcessor(event => addRequestDataToEvent(event, req as NextRequest));
36+
currentScope.addEventProcessor(event => parseRequest(event, req));
3937

4038
if (hasTracingEnabled()) {
4139
// If there is a trace header set, extract the data from it (parentSpanId, traceId, and sampling decision)
@@ -83,7 +81,7 @@ export const withSentry = (handler: NextApiHandler): WrappedNextApiHandler => {
8381
addExceptionMechanism(event, {
8482
handled: false,
8583
});
86-
return parseRequest(event, req);
84+
return event;
8785
});
8886
captureException(e);
8987
}

0 commit comments

Comments
 (0)