Skip to content

Commit bdf0330

Browse files
author
Luca Forstner
committed
Suggest not to use SentryGlobalGraphQLFilter in newer SDK versions
1 parent b94f509 commit bdf0330

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

platform-includes/getting-started-use/javascript.nestjs.mdx

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
```javascript {filename: main.ts}
22
// Import this first!
3-
import './instrument';
3+
import "./instrument";
44

55
// Now import other modules
6-
import { NestFactory } from '@nestjs/core';
7-
import { AppModule } from './app.module';
6+
import { NestFactory } from "@nestjs/core";
7+
import { AppModule } from "./app.module";
88

99
async function bootstrap() {
1010
const app = await NestFactory.create(AppModule);
@@ -17,15 +17,15 @@ bootstrap();
1717
Afterwards, add the `SentryModule` as a root module to your main module:
1818

1919
```javascript {filename: app.module.ts} {2, 8}
20-
import { Module } from '@nestjs/common';
21-
import { SentryModule } from '@sentry/nestjs/setup';
22-
import { AppController } from './app.controller';
23-
import { AppService } from './app.service';
20+
import { Module } from "@nestjs/common";
21+
import { SentryModule } from "@sentry/nestjs/setup";
22+
import { AppController } from "./app.controller";
23+
import { AppService } from "./app.service";
2424

2525
@Module({
2626
imports: [
27-
SentryModule.forRoot(),
28-
// ...other modules
27+
SentryModule.forRoot(),
28+
// ...other modules
2929
],
3030
controllers: [AppController],
3131
providers: [AppService],
@@ -56,9 +56,9 @@ module. This filter will report all unhandled errors to Sentry that are not caug
5656
**Important:** The `SentryGlobalFilter` needs to be registered before any other exception filters.
5757

5858
```javascript {3, 9}
59-
import { Module } from '@nestjs/common';
60-
import { APP_FILTER } from '@nestjs/core';
61-
import { SentryGlobalFilter } from '@sentry/nestjs/setup';
59+
import { Module } from "@nestjs/common";
60+
import { APP_FILTER } from "@nestjs/core";
61+
import { SentryGlobalFilter } from "@sentry/nestjs/setup";
6262

6363
@Module({
6464
providers: [
@@ -72,7 +72,10 @@ import { SentryGlobalFilter } from '@sentry/nestjs/setup';
7272
export class AppModule {}
7373
```
7474

75-
**Note:** In NestJS + GraphQL applications replace the `SentryGlobalFilter` with the `SentryGlobalGraphQLFilter`.
75+
{/* TODO(v9): Remove this note. */}
76+
77+
**Note:** If you have a NestJS + GraphQL application and you are using the `@sentry/nestjs` SDK version `8.38.0` or earlier, replace the `SentryGlobalFilter` with the `SentryGlobalGraphQLFilter`.
78+
In SDK versions `8.39.0` and above, the `SentryGlobalFilter` will handle GraphQL contexts automatically.
7679

7780
By default, exceptions with status code 4xx are not sent to Sentry. If you still want to capture these exceptions, you can do so manually with `Sentry.captureException()`:
7881

0 commit comments

Comments
 (0)