Skip to content

Commit 530af40

Browse files
committed
use new functions instead of old ones in nextjs SDK
1 parent a6e7d7b commit 530af40

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

packages/nextjs/src/utils/instrumentServer.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/* eslint-disable max-lines */
22
import {
3+
addRequestDataToEvent,
34
captureException,
45
configureScope,
56
deepReadDirSync,
67
getCurrentHub,
7-
Handlers,
88
startTransaction,
99
} from '@sentry/node';
1010
import { extractTraceparentData, getActiveTransaction, hasTracingEnabled } from '@sentry/tracing';
@@ -22,8 +22,6 @@ import { default as createNextServer } from 'next';
2222
import * as querystring from 'querystring';
2323
import * as url from 'url';
2424

25-
const { parseRequest } = Handlers;
26-
2725
// eslint-disable-next-line @typescript-eslint/no-explicit-any
2826
type PlainObject<T = any> = { [key: string]: T };
2927

@@ -246,7 +244,7 @@ function makeWrappedReqHandler(origReqHandler: ReqHandler): WrappedReqHandler {
246244
const currentScope = getCurrentHub().getScope();
247245

248246
if (currentScope) {
249-
currentScope.addEventProcessor(event => parseRequest(event, nextReq));
247+
currentScope.addEventProcessor(event => addRequestDataToEvent(event, nextReq));
250248

251249
// We only want to record page and API requests
252250
if (hasTracingEnabled() && shouldTraceRequest(nextReq.url, publicDirFiles)) {

packages/nextjs/src/utils/withSentry.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { captureException, flush, getCurrentHub, Handlers, startTransaction } from '@sentry/node';
1+
import { addRequestDataToEvent, captureException, flush, getCurrentHub, startTransaction } from '@sentry/node';
22
import { extractTraceparentData, hasTracingEnabled } from '@sentry/tracing';
33
import { Transaction } from '@sentry/types';
44
import {
@@ -12,8 +12,6 @@ import {
1212
import * as domain from 'domain';
1313
import { NextApiHandler, NextApiRequest, NextApiResponse } from 'next';
1414

15-
const { parseRequest } = Handlers;
16-
1715
// This is the same as the `NextApiHandler` type, except instead of having a return type of `void | Promise<void>`, it's
1816
// only `Promise<void>`, because wrapped handlers are always async
1917
export type WrappedNextApiHandler = (req: NextApiRequest, res: NextApiResponse) => Promise<void>;
@@ -43,7 +41,7 @@ export const withSentry = (origHandler: NextApiHandler): WrappedNextApiHandler =
4341
const currentScope = getCurrentHub().getScope();
4442

4543
if (currentScope) {
46-
currentScope.addEventProcessor(event => parseRequest(event, req));
44+
currentScope.addEventProcessor(event => addRequestDataToEvent(event, req));
4745

4846
if (hasTracingEnabled()) {
4947
// If there is a trace header set, extract the data from it (parentSpanId, traceId, and sampling decision)

0 commit comments

Comments
 (0)