File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
packages/node/src/integrations/tracing Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ import type { IntegrationFn } from '@sentry/types';
5
5
import { logger } from '@sentry/utils' ;
6
6
7
7
interface MinimalNestJsExecutionContext {
8
+ getType : ( ) => string ;
9
+
8
10
switchToHttp : ( ) => {
9
11
// minimal request object
10
12
// according to official types, all properties are required but
@@ -57,10 +59,13 @@ export function setupNestErrorHandler(app: MinimalNestJsApp, baseFilter: NestJsE
57
59
return next . handle ( ) ;
58
60
}
59
61
60
- const req = context . switchToHttp ( ) . getRequest ( ) ;
61
- if ( req . route ) {
62
- getIsolationScope ( ) . setTransactionName ( `${ req . method ?. toUpperCase ( ) || 'GET' } ${ req . route . path } ` ) ;
62
+ if ( context . getType ( ) === 'http' ) {
63
+ const req = context . switchToHttp ( ) . getRequest ( ) ;
64
+ if ( req . route ) {
65
+ getIsolationScope ( ) . setTransactionName ( `${ req . method ?. toUpperCase ( ) || 'GET' } ${ req . route . path } ` ) ;
66
+ }
63
67
}
68
+
64
69
return next . handle ( ) ;
65
70
} ,
66
71
} ) ;
You can’t perform that action at this time.
0 commit comments