Skip to content

Commit dc9988c

Browse files
committed
Add event procesor adding request data to event
1 parent 29ee43f commit dc9988c

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

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

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { captureException } from '@sentry/core';
1+
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+
// When the `transaction` option is set to true, it tries to extract a transaction name from the request
111+
// object. We don't want this since we already have a high-quality transaction name with a parameterized
112+
// route. Setting `transaction` to `true` will clobber that transaction name.
113+
transaction: false,
114+
},
115+
}),
116+
);
106117
}
107118

108119
try {

packages/nextjs/src/index.client.ts

-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ export * from '@sentry/react';
1111
export { nextRouterInstrumentation } from './performance/client';
1212
export { captureUnderscoreErrorException } from './utils/_error';
1313

14-
export { withSentryGetInitialProps } from './config/wrappers';
15-
1614
export { Integrations };
1715

1816
// Previously we expected users to import `BrowserTracing` like this:

0 commit comments

Comments
 (0)