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';
55import { logger } from '@sentry/utils' ;
66
77interface MinimalNestJsExecutionContext {
8+ getType : ( ) => string ;
9+
810 switchToHttp : ( ) => {
911 // minimal request object
1012 // according to official types, all properties are required but
@@ -57,10 +59,13 @@ export function setupNestErrorHandler(app: MinimalNestJsApp, baseFilter: NestJsE
5759 return next . handle ( ) ;
5860 }
5961
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+ }
6367 }
68+
6469 return next . handle ( ) ;
6570 } ,
6671 } ) ;
You can’t perform that action at this time.
0 commit comments