Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix SentryInterceptorOptions request type #105

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mjorgegulab
Copy link

Description:

I discovered a problem with the request type of SentryInterceptorOptions as it is defined as a boolean type and did not allow me to specify the keys to be removed from the request object as described in the sentry documentation.

Sentry Docs

With this fix, when you use the SentryInterceptor() you will have the option to specify the request fields that you want to extract from the request object. The following example extract only the headers from the request:

@Module({
  imports: [
    SentryModule.forRootAsync({
      imports: [ConfigModule],
      useFactory: async (configService: ConfigService) =>
        configService.get('SENTRY_CONFIG'),
      inject: [ConfigService],
    }),
  ],
  controllers: [AppController],
  providers: [
    {
      provide: APP_INTERCEPTOR,
      useFactory: () =>
        new SentryInterceptor({
          request: ['headers'],
        }),
    },
  ],
})
export class AppModule implements NestModule {}

Tests results:

Captura de pantalla 2023-01-23 a las 14 49 47


Sentry results:

Captura de pantalla 2023-01-23 a las 14 44 07

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant