1
- import { deepReadDirSync } from '@sentry/node' ;
1
+ import { captureException , deepReadDirSync , getCurrentHub , startTransaction } from '@sentry/node' ;
2
2
import { extractTraceparentData , getActiveTransaction , hasTracingEnabled } from '@sentry/tracing' ;
3
3
import { Event as SentryEvent } from '@sentry/types' ;
4
4
import { fill , isString , logger , stripUrlQueryAndFragment } from '@sentry/utils' ;
@@ -8,8 +8,6 @@ import { default as createNextServer } from 'next';
8
8
import * as querystring from 'querystring' ;
9
9
import * as url from 'url' ;
10
10
11
- import * as Sentry from '../index.server' ;
12
-
13
11
// eslint-disable-next-line @typescript-eslint/no-explicit-any
14
12
type PlainObject < T = any > = { [ key : string ] : T } ;
15
13
@@ -156,7 +154,7 @@ function makeWrappedHandlerGetter(origHandlerGetter: HandlerGetter): WrappedHand
156
154
function makeWrappedErrorLogger ( origErrorLogger : ErrorLogger ) : WrappedErrorLogger {
157
155
return function ( this : Server , err : Error ) : void {
158
156
// TODO add context data here
159
- Sentry . captureException ( err ) ;
157
+ captureException ( err ) ;
160
158
return origErrorLogger . call ( this , err ) ;
161
159
} ;
162
160
}
@@ -201,7 +199,7 @@ function makeWrappedReqHandler(origReqHandler: ReqHandler): WrappedReqHandler {
201
199
// local.on('error', Sentry.captureException);
202
200
203
201
local . run ( ( ) => {
204
- const currentScope = Sentry . getCurrentHub ( ) . getScope ( ) ;
202
+ const currentScope = getCurrentHub ( ) . getScope ( ) ;
205
203
206
204
if ( currentScope ) {
207
205
currentScope . addEventProcessor ( event => addRequestDataToEvent ( event , req ) ) ;
@@ -222,7 +220,7 @@ function makeWrappedReqHandler(origReqHandler: ReqHandler): WrappedReqHandler {
222
220
// name; requests to API routes could be GET, POST, PUT, etc, so do include it there
223
221
const namePrefix = req . url . startsWith ( '/api' ) ? `${ ( req . method || 'GET' ) . toUpperCase ( ) } ` : '' ;
224
222
225
- const transaction = Sentry . startTransaction (
223
+ const transaction = startTransaction (
226
224
{
227
225
name : `${ namePrefix } ${ reqPath } ` ,
228
226
op : 'http.server' ,
0 commit comments