From 34e289eb7a334976bd8c0c27108b9b2355bd4eb4 Mon Sep 17 00:00:00 2001 From: Andrei Borza Date: Tue, 17 Dec 2024 17:21:43 +0100 Subject: [PATCH 1/8] Add removal entry in `v8-to-v9` migration guide --- docs/migration/v8-to-v9.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/migration/v8-to-v9.md b/docs/migration/v8-to-v9.md index 59b42ca7161e..1991cc078f8a 100644 --- a/docs/migration/v8-to-v9.md +++ b/docs/migration/v8-to-v9.md @@ -108,6 +108,12 @@ It will be removed in a future major version. ### `@sentry/nestjs` +- 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. + +### `@sentry/nestjs` + - 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. From b575b0fbceba80ccb2655c6d90288a49b506ae89 Mon Sep 17 00:00:00 2001 From: Andrei Borza Date: Tue, 17 Dec 2024 17:21:43 +0100 Subject: [PATCH 2/8] Add removal entry in `v8-to-v9` migration guide --- docs/migration/v8-to-v9.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/migration/v8-to-v9.md b/docs/migration/v8-to-v9.md index 1991cc078f8a..c3539f62cb65 100644 --- a/docs/migration/v8-to-v9.md +++ b/docs/migration/v8-to-v9.md @@ -114,6 +114,12 @@ It will be removed in a future major version. ### `@sentry/nestjs` +- 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. + +### `@sentry/nestjs` + - 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. From 572c669800125e80750ec60b2cc9a73e74f50dc9 Mon Sep 17 00:00:00 2001 From: Andrei Borza Date: Tue, 17 Dec 2024 16:36:47 +0100 Subject: [PATCH 3/8] feat(nestjs): Remove `SentryTracingInterceptor` export --- packages/nestjs/src/setup.ts | 9 --------- 1 file changed, 9 deletions(-) diff --git a/packages/nestjs/src/setup.ts b/packages/nestjs/src/setup.ts index a5d670402d68..ffcd706c52ef 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. @@ -179,7 +172,6 @@ class SentryModule { providers: [ { provide: APP_INTERCEPTOR, - // eslint-disable-next-line deprecation/deprecation useClass: SentryTracingInterceptor, }, ], @@ -191,7 +183,6 @@ Module({ providers: [ { provide: APP_INTERCEPTOR, - // eslint-disable-next-line deprecation/deprecation useClass: SentryTracingInterceptor, }, ], From 82b867ab61f0858a406cf8d1500bcb81f8a6b8be Mon Sep 17 00:00:00 2001 From: Andrei Borza Date: Tue, 17 Dec 2024 16:50:58 +0100 Subject: [PATCH 4/8] Remove `SentryGlobalGraphQLFilter` --- .../nestjs-graphql/src/app.module.ts | 4 +-- packages/nestjs/src/setup.ts | 35 ------------------- 2 files changed, 2 insertions(+), 37 deletions(-) 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/packages/nestjs/src/setup.ts b/packages/nestjs/src/setup.ts index ffcd706c52ef..b559573e6413 100644 --- a/packages/nestjs/src/setup.ts +++ b/packages/nestjs/src/setup.ts @@ -115,41 +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. * From 52ad216861c923b6afb77bb916ac50911f41e7cf Mon Sep 17 00:00:00 2001 From: Andrei Borza Date: Tue, 17 Dec 2024 16:55:41 +0100 Subject: [PATCH 5/8] Remove `SentryGlobalGenericFilter` --- .../nestjs-basic-with-graphql/src/main.ts | 4 ++-- packages/nestjs/src/setup.ts | 9 --------- 2 files changed, 2 insertions(+), 11 deletions(-) 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/packages/nestjs/src/setup.ts b/packages/nestjs/src/setup.ts index b559573e6413..d45d2d7d4900 100644 --- a/packages/nestjs/src/setup.ts +++ b/packages/nestjs/src/setup.ts @@ -115,15 +115,6 @@ class SentryGlobalFilter extends BaseExceptionFilter { Catch()(SentryGlobalFilter); export { SentryGlobalFilter }; -/** - * 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. */ From e195e461c5632b2bea93ea4c473ef6fc6dc4985a Mon Sep 17 00:00:00 2001 From: Andrei Borza Date: Tue, 17 Dec 2024 16:55:59 +0100 Subject: [PATCH 6/8] Update `clean` command to clean up types and the correct tarball --- packages/nestjs/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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", From 0ae60970019e5b4b67273759c916991545beba05 Mon Sep 17 00:00:00 2001 From: Andrei Borza Date: Tue, 17 Dec 2024 17:18:00 +0100 Subject: [PATCH 7/8] Add removal entries to `v8-to-v9.md` --- docs/migration/v8-to-v9.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/migration/v8-to-v9.md b/docs/migration/v8-to-v9.md index c3539f62cb65..1fc6ab7cb2d3 100644 --- a/docs/migration/v8-to-v9.md +++ b/docs/migration/v8-to-v9.md @@ -123,6 +123,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 From adb0f7733d4f02f10b5008a81eb2ca478cd864b3 Mon Sep 17 00:00:00 2001 From: Andrei Borza Date: Tue, 17 Dec 2024 17:43:51 +0100 Subject: [PATCH 8/8] Fix migration guide --- docs/migration/v8-to-v9.md | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/docs/migration/v8-to-v9.md b/docs/migration/v8-to-v9.md index 1fc6ab7cb2d3..ff1adc85dfd4 100644 --- a/docs/migration/v8-to-v9.md +++ b/docs/migration/v8-to-v9.md @@ -108,18 +108,6 @@ It will be removed in a future major version. ### `@sentry/nestjs` -- 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. - -### `@sentry/nestjs` - -- 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. - -### `@sentry/nestjs` - - 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.