From a703dc48e4b3eaf58aa1d8044a31136afa071be9 Mon Sep 17 00:00:00 2001 From: nicohrubec Date: Sat, 31 Aug 2024 13:36:39 +0200 Subject: [PATCH 1/6] Add tests to verify behavior --- .../nestjs-basic/src/app.controller.ts | 20 +++++++++++++++++++ .../nestjs-basic/src/app.service.ts | 16 +++++++++++++++ .../nestjs-basic/tests/transactions.test.ts | 20 +++++++++++++++++++ .../node-nestjs-basic/src/app.controller.ts | 20 +++++++++++++++++++ .../node-nestjs-basic/src/app.service.ts | 16 +++++++++++++++ .../tests/transactions.test.ts | 20 +++++++++++++++++++ 6 files changed, 112 insertions(+) diff --git a/dev-packages/e2e-tests/test-applications/nestjs-basic/src/app.controller.ts b/dev-packages/e2e-tests/test-applications/nestjs-basic/src/app.controller.ts index 1649cdb94b5f..75308e8f0ea9 100644 --- a/dev-packages/e2e-tests/test-applications/nestjs-basic/src/app.controller.ts +++ b/dev-packages/e2e-tests/test-applications/nestjs-basic/src/app.controller.ts @@ -96,4 +96,24 @@ export class AppController { async exampleExceptionLocalFilter() { throw new ExampleExceptionLocalFilter(); } + + @Get('test-service-use') + testServiceWithUseMethod() { + return this.appService.use(); + } + + @Get('test-service-transform') + testServiceWithTransform() { + return this.appService.transform(); + } + + @Get('test-service-intercept') + testServiceWithIntercept() { + return this.appService.intercept(); + } + + @Get('test-service-canActivate') + testServiceWithCanActivate() { + return this.appService.canActivate(); + } } diff --git a/dev-packages/e2e-tests/test-applications/nestjs-basic/src/app.service.ts b/dev-packages/e2e-tests/test-applications/nestjs-basic/src/app.service.ts index f1c935257013..3e4639040a7e 100644 --- a/dev-packages/e2e-tests/test-applications/nestjs-basic/src/app.service.ts +++ b/dev-packages/e2e-tests/test-applications/nestjs-basic/src/app.service.ts @@ -78,4 +78,20 @@ export class AppService { async killTestCron() { this.schedulerRegistry.deleteCronJob('test-cron-job'); } + + use() { + console.log('Test use!'); + } + + transform() { + console.log('Test transform!'); + } + + intercept() { + console.log('Test intercept!'); + } + + canActivate() { + console.log('Test canActivate!'); + } } diff --git a/dev-packages/e2e-tests/test-applications/nestjs-basic/tests/transactions.test.ts b/dev-packages/e2e-tests/test-applications/nestjs-basic/tests/transactions.test.ts index e33e63f319ca..a9c8ffea9117 100644 --- a/dev-packages/e2e-tests/test-applications/nestjs-basic/tests/transactions.test.ts +++ b/dev-packages/e2e-tests/test-applications/nestjs-basic/tests/transactions.test.ts @@ -707,3 +707,23 @@ test('API route transaction includes exactly one nest async interceptor span aft // 'Interceptor - After Route' is NOT the parent of 'test-controller-span' expect(testControllerSpan.parent_span_id).not.toBe(exampleInterceptorSpanAfterRouteId); }); + +test('Calling use method on service with Injectable decorator returns 200', async ({ baseURL }) => { + const response = await fetch(`${baseURL}/test-service-use`); + expect(response.status).toBe(200); +}); + +test('Calling transform method on service with Injectable decorator returns 200', async ({ baseURL }) => { + const response = await fetch(`${baseURL}/test-service-transform`); + expect(response.status).toBe(200); +}); + +test('Calling intercept method on service with Injectable decorator returns 200', async ({ baseURL }) => { + const response = await fetch(`${baseURL}/test-service-intercept`); + expect(response.status).toBe(200); +}); + +test('Calling canActivate method on service with Injectable decorator returns 200', async ({ baseURL }) => { + const response = await fetch(`${baseURL}/test-service-canActivate`); + expect(response.status).toBe(200); +}); diff --git a/dev-packages/e2e-tests/test-applications/node-nestjs-basic/src/app.controller.ts b/dev-packages/e2e-tests/test-applications/node-nestjs-basic/src/app.controller.ts index 1f141dc0f966..70c734c61d73 100644 --- a/dev-packages/e2e-tests/test-applications/node-nestjs-basic/src/app.controller.ts +++ b/dev-packages/e2e-tests/test-applications/node-nestjs-basic/src/app.controller.ts @@ -82,4 +82,24 @@ export class AppController { async flush() { await flush(); } + + @Get('test-service-use') + testServiceWithUseMethod() { + return this.appService.use(); + } + + @Get('test-service-transform') + testServiceWithTransform() { + return this.appService.transform(); + } + + @Get('test-service-intercept') + testServiceWithIntercept() { + return this.appService.intercept(); + } + + @Get('test-service-canActivate') + testServiceWithCanActivate() { + return this.appService.canActivate(); + } } diff --git a/dev-packages/e2e-tests/test-applications/node-nestjs-basic/src/app.service.ts b/dev-packages/e2e-tests/test-applications/node-nestjs-basic/src/app.service.ts index f1c935257013..3e4639040a7e 100644 --- a/dev-packages/e2e-tests/test-applications/node-nestjs-basic/src/app.service.ts +++ b/dev-packages/e2e-tests/test-applications/node-nestjs-basic/src/app.service.ts @@ -78,4 +78,20 @@ export class AppService { async killTestCron() { this.schedulerRegistry.deleteCronJob('test-cron-job'); } + + use() { + console.log('Test use!'); + } + + transform() { + console.log('Test transform!'); + } + + intercept() { + console.log('Test intercept!'); + } + + canActivate() { + console.log('Test canActivate!'); + } } diff --git a/dev-packages/e2e-tests/test-applications/node-nestjs-basic/tests/transactions.test.ts b/dev-packages/e2e-tests/test-applications/node-nestjs-basic/tests/transactions.test.ts index eb52dfe98585..23855d1f55b8 100644 --- a/dev-packages/e2e-tests/test-applications/node-nestjs-basic/tests/transactions.test.ts +++ b/dev-packages/e2e-tests/test-applications/node-nestjs-basic/tests/transactions.test.ts @@ -705,3 +705,23 @@ test('API route transaction includes exactly one nest async interceptor span aft // 'Interceptor - After Route' is NOT the parent of 'test-controller-span' expect(testControllerSpan.parent_span_id).not.toBe(exampleInterceptorSpanAfterRouteId); }); + +test('Calling use method on service with Injectable decorator returns 200', async ({ baseURL }) => { + const response = await fetch(`${baseURL}/test-service-use`); + expect(response.status).toBe(200); +}); + +test('Calling transform method on service with Injectable decorator returns 200', async ({ baseURL }) => { + const response = await fetch(`${baseURL}/test-service-transform`); + expect(response.status).toBe(200); +}); + +test('Calling intercept method on service with Injectable decorator returns 200', async ({ baseURL }) => { + const response = await fetch(`${baseURL}/test-service-intercept`); + expect(response.status).toBe(200); +}); + +test('Calling canActivate method on service with Injectable decorator returns 200', async ({ baseURL }) => { + const response = await fetch(`${baseURL}/test-service-canActivate`); + expect(response.status).toBe(200); +}); From 7a154f91039445ea8d124b0f9549a550b8bb8881 Mon Sep 17 00:00:00 2001 From: nicohrubec Date: Sat, 31 Aug 2024 14:10:44 +0200 Subject: [PATCH 2/6] Fix middleware instrumentation --- .../src/integrations/tracing/nest/helpers.ts | 20 +++++++++++ .../nest/sentry-nest-instrumentation.ts | 33 ++++++++++--------- .../src/integrations/tracing/nest/types.ts | 5 +++ 3 files changed, 42 insertions(+), 16 deletions(-) diff --git a/packages/node/src/integrations/tracing/nest/helpers.ts b/packages/node/src/integrations/tracing/nest/helpers.ts index e2d3c4c573b9..f62b618fbfde 100644 --- a/packages/node/src/integrations/tracing/nest/helpers.ts +++ b/packages/node/src/integrations/tracing/nest/helpers.ts @@ -53,3 +53,23 @@ export function instrumentObservable(observable: Observable, activeSpan }); } } + +/** + * + */ +// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-function-return-type +export function getNextProxy(next: any, span: Span, prevSpan: undefined | Span) { + return new Proxy(next, { + apply: (originalNext, thisArgNext, argsNext) => { + span.end(); + + if (prevSpan) { + return withActiveSpan(prevSpan, () => { + return Reflect.apply(originalNext, thisArgNext, argsNext); + }); + } else { + return Reflect.apply(originalNext, thisArgNext, argsNext); + } + }, + }); +} diff --git a/packages/node/src/integrations/tracing/nest/sentry-nest-instrumentation.ts b/packages/node/src/integrations/tracing/nest/sentry-nest-instrumentation.ts index b8ea782ee66f..1bfb21958d18 100644 --- a/packages/node/src/integrations/tracing/nest/sentry-nest-instrumentation.ts +++ b/packages/node/src/integrations/tracing/nest/sentry-nest-instrumentation.ts @@ -8,8 +8,15 @@ import { import { getActiveSpan, startInactiveSpan, startSpan, startSpanManual, withActiveSpan } from '@sentry/core'; import type { Span } from '@sentry/types'; import { SDK_VERSION, addNonEnumerableProperty, isThenable } from '@sentry/utils'; -import { getMiddlewareSpanOptions, instrumentObservable, isPatched } from './helpers'; -import type { CallHandler, CatchTarget, InjectableTarget, MinimalNestJsExecutionContext, Observable } from './types'; +import { getMiddlewareSpanOptions, getNextProxy, instrumentObservable, isPatched } from './helpers'; +import type { + CallHandler, + CatchTarget, + InjectableTarget, + MinimalNestJsExecutionContext, + NextFunction, + Observable, +} from './types'; const supportedVersions = ['>=8.0.0 <11']; @@ -103,21 +110,15 @@ export class SentryNestInstrumentation extends InstrumentationBase { const [req, res, next, ...args] = argsUse; const prevSpan = getActiveSpan(); - return startSpanManual(getMiddlewareSpanOptions(target), (span: Span) => { - const nextProxy = new Proxy(next, { - apply: (originalNext, thisArgNext, argsNext) => { - span.end(); - - if (prevSpan) { - return withActiveSpan(prevSpan, () => { - return Reflect.apply(originalNext, thisArgNext, argsNext); - }); - } else { - return Reflect.apply(originalNext, thisArgNext, argsNext); - } - }, - }); + // Only proxy actual middleware. + // Without this guard instrumentation will fail if a function called use on a service decorated + // with @Injectable is called. + if (!(next satisfies NextFunction)) { + return originalUse.apply(thisArgUse, argsUse); + } + return startSpanManual(getMiddlewareSpanOptions(target), (span: Span) => { + const nextProxy = getNextProxy(next, span, prevSpan); return originalUse.apply(thisArgUse, [req, res, nextProxy, args]); }); }, diff --git a/packages/node/src/integrations/tracing/nest/types.ts b/packages/node/src/integrations/tracing/nest/types.ts index 18bd26b31ccb..0590462c09d5 100644 --- a/packages/node/src/integrations/tracing/nest/types.ts +++ b/packages/node/src/integrations/tracing/nest/types.ts @@ -73,3 +73,8 @@ export interface CatchTarget { catch?: (...args: any[]) => any; }; } + +/** + * Represents an express NextFunction. + */ +export type NextFunction = (err?: any) => void; From 7f7bac669a1da583370fffa54c0168c37a0fcb06 Mon Sep 17 00:00:00 2001 From: nicohrubec Date: Mon, 2 Sep 2024 09:08:24 +0200 Subject: [PATCH 3/6] Cleanup --- packages/node/src/integrations/tracing/nest/helpers.ts | 7 +++---- .../tracing/nest/sentry-nest-instrumentation.ts | 7 ++++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/node/src/integrations/tracing/nest/helpers.ts b/packages/node/src/integrations/tracing/nest/helpers.ts index f62b618fbfde..cc83dda3855d 100644 --- a/packages/node/src/integrations/tracing/nest/helpers.ts +++ b/packages/node/src/integrations/tracing/nest/helpers.ts @@ -1,7 +1,7 @@ import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, withActiveSpan } from '@sentry/core'; import type { Span } from '@sentry/types'; import { addNonEnumerableProperty } from '@sentry/utils'; -import type { CatchTarget, InjectableTarget, Observable, Subscription } from './types'; +import type { CatchTarget, InjectableTarget, NextFunction, Observable, Subscription } from './types'; const sentryPatched = 'sentryPatched'; @@ -55,10 +55,9 @@ export function instrumentObservable(observable: Observable, activeSpan } /** - * + * Proxies the next() call in a nestjs middleware to end the span when it is called. */ -// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-function-return-type -export function getNextProxy(next: any, span: Span, prevSpan: undefined | Span) { +export function getNextProxy(next: NextFunction, span: Span, prevSpan: undefined | Span): NextFunction { return new Proxy(next, { apply: (originalNext, thisArgNext, argsNext) => { span.end(); diff --git a/packages/node/src/integrations/tracing/nest/sentry-nest-instrumentation.ts b/packages/node/src/integrations/tracing/nest/sentry-nest-instrumentation.ts index 1bfb21958d18..f2622b789988 100644 --- a/packages/node/src/integrations/tracing/nest/sentry-nest-instrumentation.ts +++ b/packages/node/src/integrations/tracing/nest/sentry-nest-instrumentation.ts @@ -110,14 +110,15 @@ export class SentryNestInstrumentation extends InstrumentationBase { const [req, res, next, ...args] = argsUse; const prevSpan = getActiveSpan(); - // Only proxy actual middleware. - // Without this guard instrumentation will fail if a function called use on a service decorated - // with @Injectable is called. + // Check that we can reasonably assume that the target is a middleware. + // Without this guard, instrumentation will fail if a function named 'use' on a service, which is + // decorated with @Injectable, is called. if (!(next satisfies NextFunction)) { return originalUse.apply(thisArgUse, argsUse); } return startSpanManual(getMiddlewareSpanOptions(target), (span: Span) => { + // proxy next to end span on call const nextProxy = getNextProxy(next, span, prevSpan); return originalUse.apply(thisArgUse, [req, res, nextProxy, args]); }); From 52334600a964774aa83ef1af95b3a6684bf3532f Mon Sep 17 00:00:00 2001 From: nicohrubec Date: Mon, 2 Sep 2024 11:37:20 +0200 Subject: [PATCH 4/6] More checks --- .../nest/sentry-nest-instrumentation.ts | 62 ++++++++++++++++--- 1 file changed, 52 insertions(+), 10 deletions(-) diff --git a/packages/node/src/integrations/tracing/nest/sentry-nest-instrumentation.ts b/packages/node/src/integrations/tracing/nest/sentry-nest-instrumentation.ts index f2622b789988..5f612e51e737 100644 --- a/packages/node/src/integrations/tracing/nest/sentry-nest-instrumentation.ts +++ b/packages/node/src/integrations/tracing/nest/sentry-nest-instrumentation.ts @@ -9,14 +9,7 @@ import { getActiveSpan, startInactiveSpan, startSpan, startSpanManual, withActiv import type { Span } from '@sentry/types'; import { SDK_VERSION, addNonEnumerableProperty, isThenable } from '@sentry/utils'; import { getMiddlewareSpanOptions, getNextProxy, instrumentObservable, isPatched } from './helpers'; -import type { - CallHandler, - CatchTarget, - InjectableTarget, - MinimalNestJsExecutionContext, - NextFunction, - Observable, -} from './types'; +import type { CallHandler, CatchTarget, InjectableTarget, MinimalNestJsExecutionContext, Observable } from './types'; const supportedVersions = ['>=8.0.0 <11']; @@ -107,13 +100,18 @@ export class SentryNestInstrumentation extends InstrumentationBase { target.prototype.use = new Proxy(target.prototype.use, { apply: (originalUse, thisArgUse, argsUse) => { + // Middlewares have a request, response and next argument. + if (argsUse.length < 3) { + return originalUse.apply(thisArgUse, argsUse); + } + const [req, res, next, ...args] = argsUse; const prevSpan = getActiveSpan(); // Check that we can reasonably assume that the target is a middleware. - // Without this guard, instrumentation will fail if a function named 'use' on a service, which is + // Without these guards, instrumentation will fail if a function named 'use' on a service, which is // decorated with @Injectable, is called. - if (!(next satisfies NextFunction)) { + if (!req || !res || !next || !(typeof next === 'function')) { return originalUse.apply(thisArgUse, argsUse); } @@ -135,6 +133,17 @@ export class SentryNestInstrumentation extends InstrumentationBase { target.prototype.canActivate = new Proxy(target.prototype.canActivate, { apply: (originalCanActivate, thisArgCanActivate, argsCanActivate) => { + // Guards have a context argument. + if (argsCanActivate.length == 0) { + return originalCanActivate.apply(thisArgCanActivate, argsCanActivate); + } + + const context: MinimalNestJsExecutionContext = argsCanActivate[0]; + + if (!context) { + return originalCanActivate.apply(thisArgCanActivate, argsCanActivate); + } + return startSpan(getMiddlewareSpanOptions(target), () => { return originalCanActivate.apply(thisArgCanActivate, argsCanActivate); }); @@ -150,6 +159,18 @@ export class SentryNestInstrumentation extends InstrumentationBase { target.prototype.transform = new Proxy(target.prototype.transform, { apply: (originalTransform, thisArgTransform, argsTransform) => { + // Pipes have a value and metadata argument. + if (argsTransform.length < 2) { + return originalTransform.apply(thisArgTransform, argsTransform); + } + + const value = argsTransform[0]; + const metadata = argsTransform[1]; + + if (!value || !metadata) { + return originalTransform.apply(thisArgTransform, argsTransform); + } + return startSpan(getMiddlewareSpanOptions(target), () => { return originalTransform.apply(thisArgTransform, argsTransform); }); @@ -165,12 +186,22 @@ export class SentryNestInstrumentation extends InstrumentationBase { target.prototype.intercept = new Proxy(target.prototype.intercept, { apply: (originalIntercept, thisArgIntercept, argsIntercept) => { + // Interceptors have a context and next argument. + if (argsIntercept.length < 2) { + return originalIntercept.apply(thisArgIntercept, argsIntercept); + } + const context: MinimalNestJsExecutionContext = argsIntercept[0]; const next: CallHandler = argsIntercept[1]; const parentSpan = getActiveSpan(); let afterSpan: Span; + // Check that we can reasonably assume that the target is an interceptor. + if (!context || !next || !(typeof next.handle === 'function')) { + return originalIntercept.apply(thisArgIntercept, argsIntercept); + } + return startSpanManual(getMiddlewareSpanOptions(target), (beforeSpan: Span) => { // eslint-disable-next-line @typescript-eslint/unbound-method next.handle = new Proxy(next.handle, { @@ -265,6 +296,17 @@ export class SentryNestInstrumentation extends InstrumentationBase { target.prototype.catch = new Proxy(target.prototype.catch, { apply: (originalCatch, thisArgCatch, argsCatch) => { + if (argsCatch.length < 2) { + return originalCatch.apply(thisArgCatch, argsCatch); + } + + const exception = argsCatch[0]; + const host = argsCatch[1]; + + if (!exception || !host) { + return originalCatch.apply(thisArgCatch, argsCatch); + } + return startSpan(getMiddlewareSpanOptions(target), () => { return originalCatch.apply(thisArgCatch, argsCatch); }); From 4f2d735343bf179c20325d75c66d16ce3d3bed7b Mon Sep 17 00:00:00 2001 From: nicohrubec Date: Mon, 2 Sep 2024 13:31:38 +0200 Subject: [PATCH 5/6] =?UTF-8?q?Address=20some=20pr=20comments=C2=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../integrations/tracing/nest/sentry-nest-instrumentation.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/node/src/integrations/tracing/nest/sentry-nest-instrumentation.ts b/packages/node/src/integrations/tracing/nest/sentry-nest-instrumentation.ts index 5f612e51e737..058ca58bf6f0 100644 --- a/packages/node/src/integrations/tracing/nest/sentry-nest-instrumentation.ts +++ b/packages/node/src/integrations/tracing/nest/sentry-nest-instrumentation.ts @@ -111,7 +111,7 @@ export class SentryNestInstrumentation extends InstrumentationBase { // Check that we can reasonably assume that the target is a middleware. // Without these guards, instrumentation will fail if a function named 'use' on a service, which is // decorated with @Injectable, is called. - if (!req || !res || !next || !(typeof next === 'function')) { + if (!req || !res || !next || typeof next !== 'function') { return originalUse.apply(thisArgUse, argsUse); } @@ -198,7 +198,7 @@ export class SentryNestInstrumentation extends InstrumentationBase { let afterSpan: Span; // Check that we can reasonably assume that the target is an interceptor. - if (!context || !next || !(typeof next.handle === 'function')) { + if (!context || !next || typeof next.handle !== 'function') { return originalIntercept.apply(thisArgIntercept, argsIntercept); } From 5f79bc427ebd6565cc3580474ee8596efee65c25 Mon Sep 17 00:00:00 2001 From: nicohrubec Date: Mon, 2 Sep 2024 15:47:05 +0200 Subject: [PATCH 6/6] Remove redundant steps --- .../nest/sentry-nest-instrumentation.ts | 27 ++----------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/packages/node/src/integrations/tracing/nest/sentry-nest-instrumentation.ts b/packages/node/src/integrations/tracing/nest/sentry-nest-instrumentation.ts index 058ca58bf6f0..2d59d97d87fd 100644 --- a/packages/node/src/integrations/tracing/nest/sentry-nest-instrumentation.ts +++ b/packages/node/src/integrations/tracing/nest/sentry-nest-instrumentation.ts @@ -100,13 +100,7 @@ export class SentryNestInstrumentation extends InstrumentationBase { target.prototype.use = new Proxy(target.prototype.use, { apply: (originalUse, thisArgUse, argsUse) => { - // Middlewares have a request, response and next argument. - if (argsUse.length < 3) { - return originalUse.apply(thisArgUse, argsUse); - } - const [req, res, next, ...args] = argsUse; - const prevSpan = getActiveSpan(); // Check that we can reasonably assume that the target is a middleware. // Without these guards, instrumentation will fail if a function named 'use' on a service, which is @@ -115,6 +109,8 @@ export class SentryNestInstrumentation extends InstrumentationBase { return originalUse.apply(thisArgUse, argsUse); } + const prevSpan = getActiveSpan(); + return startSpanManual(getMiddlewareSpanOptions(target), (span: Span) => { // proxy next to end span on call const nextProxy = getNextProxy(next, span, prevSpan); @@ -133,11 +129,6 @@ export class SentryNestInstrumentation extends InstrumentationBase { target.prototype.canActivate = new Proxy(target.prototype.canActivate, { apply: (originalCanActivate, thisArgCanActivate, argsCanActivate) => { - // Guards have a context argument. - if (argsCanActivate.length == 0) { - return originalCanActivate.apply(thisArgCanActivate, argsCanActivate); - } - const context: MinimalNestJsExecutionContext = argsCanActivate[0]; if (!context) { @@ -159,11 +150,6 @@ export class SentryNestInstrumentation extends InstrumentationBase { target.prototype.transform = new Proxy(target.prototype.transform, { apply: (originalTransform, thisArgTransform, argsTransform) => { - // Pipes have a value and metadata argument. - if (argsTransform.length < 2) { - return originalTransform.apply(thisArgTransform, argsTransform); - } - const value = argsTransform[0]; const metadata = argsTransform[1]; @@ -186,11 +172,6 @@ export class SentryNestInstrumentation extends InstrumentationBase { target.prototype.intercept = new Proxy(target.prototype.intercept, { apply: (originalIntercept, thisArgIntercept, argsIntercept) => { - // Interceptors have a context and next argument. - if (argsIntercept.length < 2) { - return originalIntercept.apply(thisArgIntercept, argsIntercept); - } - const context: MinimalNestJsExecutionContext = argsIntercept[0]; const next: CallHandler = argsIntercept[1]; @@ -296,10 +277,6 @@ export class SentryNestInstrumentation extends InstrumentationBase { target.prototype.catch = new Proxy(target.prototype.catch, { apply: (originalCatch, thisArgCatch, argsCatch) => { - if (argsCatch.length < 2) { - return originalCatch.apply(thisArgCatch, argsCatch); - } - const exception = argsCatch[0]; const host = argsCatch[1];