diff --git a/dev-packages/e2e-tests/test-applications/nestjs-basic-with-graphql/src/main.ts b/dev-packages/e2e-tests/test-applications/nestjs-basic-with-graphql/src/main.ts index 947539414ddf..1456fd17b9e1 100644 --- a/dev-packages/e2e-tests/test-applications/nestjs-basic-with-graphql/src/main.ts +++ b/dev-packages/e2e-tests/test-applications/nestjs-basic-with-graphql/src/main.ts @@ -3,7 +3,7 @@ import './instrument'; // Import other modules import { HttpAdapterHost, NestFactory } from '@nestjs/core'; -import { SentryGlobalGenericFilter } from '@sentry/nestjs/setup'; +import { SentryGlobalFilter } from '@sentry/nestjs/setup'; import { AppModule } from './app.module'; const PORT = 3030; @@ -12,7 +12,7 @@ async function bootstrap() { const app = await NestFactory.create(AppModule); const { httpAdapter } = app.get(HttpAdapterHost); - app.useGlobalFilters(new SentryGlobalGenericFilter(httpAdapter as any)); + app.useGlobalFilters(new SentryGlobalFilter(httpAdapter as any)); await app.listen(PORT); } diff --git a/dev-packages/e2e-tests/test-applications/nestjs-graphql/src/app.module.ts b/dev-packages/e2e-tests/test-applications/nestjs-graphql/src/app.module.ts index 4cfc2ebd33e4..6eba5ad74cbe 100644 --- a/dev-packages/e2e-tests/test-applications/nestjs-graphql/src/app.module.ts +++ b/dev-packages/e2e-tests/test-applications/nestjs-graphql/src/app.module.ts @@ -2,7 +2,7 @@ import { ApolloDriver } from '@nestjs/apollo'; import { Logger, Module } from '@nestjs/common'; import { APP_FILTER } from '@nestjs/core'; import { GraphQLModule } from '@nestjs/graphql'; -import { SentryGlobalGraphQLFilter, SentryModule } from '@sentry/nestjs/setup'; +import { SentryGlobalFilter, SentryModule } from '@sentry/nestjs/setup'; import { AppResolver } from './app.resolver'; @Module({ @@ -19,7 +19,7 @@ import { AppResolver } from './app.resolver'; AppResolver, { provide: APP_FILTER, - useClass: SentryGlobalGraphQLFilter, + useClass: SentryGlobalFilter, }, { provide: Logger, diff --git a/docs/migration/v8-to-v9.md b/docs/migration/v8-to-v9.md index 59b42ca7161e..ff1adc85dfd4 100644 --- a/docs/migration/v8-to-v9.md +++ b/docs/migration/v8-to-v9.md @@ -111,6 +111,15 @@ It will be removed in a future major version. - Removed `SentryService`. If you are using `@sentry/nestjs` you can safely remove any references to the `SentryService`. If you are using another package migrate to `@sentry/nestjs` and remove the `SentryService` afterwards. +- Removed `SentryTracingInterceptor`. + If you are using `@sentry/nestjs` you can safely remove any references to the `SentryTracingInterceptor`. + If you are using another package migrate to `@sentry/nestjs` and remove the `SentryTracingInterceptor` afterwards. +- Removed `SentryGlobalGenericFilter`. + Use the `SentryGlobalFilter` instead. + The `SentryGlobalFilter` is a drop-in replacement. +- Removed `SentryGlobalGraphQLFilter`. + Use the `SentryGlobalFilter` instead. + The `SentryGlobalFilter` is a drop-in replacement. ## 5. Build Changes diff --git a/packages/nestjs/package.json b/packages/nestjs/package.json index 56ab66b31cd5..a11de76a0c31 100644 --- a/packages/nestjs/package.json +++ b/packages/nestjs/package.json @@ -71,7 +71,7 @@ "build:types:watch": "tsc -p tsconfig.types.json --watch", "build:tarball": "npm pack", "circularDepCheck": "madge --circular src/index.ts && madge --circular src/setup.ts", - "clean": "rimraf build coverage sentry-node-*.tgz", + "clean": "rimraf build coverage sentry-nestjs-*.tgz ./*.d.ts ./*.d.ts.map", "fix": "eslint . --format stylish --fix", "lint": "eslint . --format stylish", "test": "vitest run", diff --git a/packages/nestjs/src/setup.ts b/packages/nestjs/src/setup.ts index a5d670402d68..d45d2d7d4900 100644 --- a/packages/nestjs/src/setup.ts +++ b/packages/nestjs/src/setup.ts @@ -35,10 +35,6 @@ interface ExpressRequest { /** * Interceptor to add Sentry tracing capabilities to Nest.js applications. - * - * @deprecated `SentryTracingInterceptor` is deprecated. - * If you are using `@sentry/nestjs` you can safely remove any references to the `SentryTracingInterceptor`. - * If you are using another package migrate to `@sentry/nestjs` and remove the `SentryTracingInterceptor` afterwards. */ class SentryTracingInterceptor implements NestInterceptor { // used to exclude this class from being auto-instrumented @@ -73,10 +69,7 @@ class SentryTracingInterceptor implements NestInterceptor { return next.handle(); } } -// eslint-disable-next-line deprecation/deprecation Injectable()(SentryTracingInterceptor); -// eslint-disable-next-line deprecation/deprecation -export { SentryTracingInterceptor }; /** * Global filter to handle exceptions and report them to Sentry. @@ -122,50 +115,6 @@ class SentryGlobalFilter extends BaseExceptionFilter { Catch()(SentryGlobalFilter); export { SentryGlobalFilter }; -/** - * Global filter to handle exceptions in NestJS + GraphQL applications and report them to Sentry. - * - * @deprecated `SentryGlobalGraphQLFilter` is deprecated. Use the `SentryGlobalFilter` instead. The `SentryGlobalFilter` is a drop-in replacement. - */ -class SentryGlobalGraphQLFilter { - private static readonly _logger = new Logger('ExceptionsHandler'); - public readonly __SENTRY_INTERNAL__: boolean; - - public constructor() { - this.__SENTRY_INTERNAL__ = true; - } - - /** - * Catches exceptions and reports them to Sentry unless they are HttpExceptions. - */ - // eslint-disable-next-line @typescript-eslint/no-unused-vars - public catch(exception: unknown, host: ArgumentsHost): void { - // neither report nor log HttpExceptions - if (exception instanceof HttpException) { - throw exception; - } - if (exception instanceof Error) { - // eslint-disable-next-line deprecation/deprecation - SentryGlobalGraphQLFilter._logger.error(exception.message, exception.stack); - } - captureException(exception); - throw exception; - } -} -// eslint-disable-next-line deprecation/deprecation -Catch()(SentryGlobalGraphQLFilter); -// eslint-disable-next-line deprecation/deprecation -export { SentryGlobalGraphQLFilter }; - -/** - * Global filter to handle exceptions and report them to Sentry. - * - * This filter is a generic filter that can handle both HTTP and GraphQL exceptions. - * - * @deprecated `SentryGlobalGenericFilter` is deprecated. Use the `SentryGlobalFilter` instead. The `SentryGlobalFilter` is a drop-in replacement. - */ -export const SentryGlobalGenericFilter = SentryGlobalFilter; - /** * Set up a root module that can be injected in nest applications. */ @@ -179,7 +128,6 @@ class SentryModule { providers: [ { provide: APP_INTERCEPTOR, - // eslint-disable-next-line deprecation/deprecation useClass: SentryTracingInterceptor, }, ], @@ -191,7 +139,6 @@ Module({ providers: [ { provide: APP_INTERCEPTOR, - // eslint-disable-next-line deprecation/deprecation useClass: SentryTracingInterceptor, }, ],