Skip to content

Commit 1830018

Browse files
committed
Add event procesor adding request data to event
1 parent 638afc6 commit 1830018

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

packages/nextjs/src/config/wrappers/wrapperUtils.ts

+11
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { captureException, getCurrentHub, startTransaction } from '@sentry/core';
2+
import { addRequestDataToEvent } from '@sentry/node';
23
import { getActiveTransaction } from '@sentry/tracing';
34
import { Transaction } from '@sentry/types';
45
import { fill } from '@sentry/utils';
@@ -103,6 +104,16 @@ export function callTracedServerSideDataFetcher<F extends (...args: any[]) => Pr
103104
const currentScope = getCurrentHub().getScope();
104105
if (currentScope) {
105106
currentScope.setSpan(dataFetcherSpan);
107+
currentScope.addEventProcessor(event =>
108+
addRequestDataToEvent(event, req, {
109+
include: {
110+
// The `transaction` option tries to extract a transaction name from the request object. We don't want this
111+
// since we already have a high-quality transaction name with a parameterized route. Setting `transaction`
112+
// to `true` will clobber that transaction name.
113+
transaction: false,
114+
},
115+
}),
116+
);
106117
}
107118

108119
try {

0 commit comments

Comments
 (0)