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

Filter all RpcExceptions in @sentry/nestjs #13190

Closed
Tracked by #12504
pesix opened this issue Aug 2, 2024 · 2 comments · Fixed by #13227
Closed
Tracked by #12504

Filter all RpcExceptions in @sentry/nestjs #13190

pesix opened this issue Aug 2, 2024 · 2 comments · Fixed by #13227
Assignees
Labels
Package: nestjs Issues related to the Sentry Nestjs SDK Type: Improvement

Comments

@pesix
Copy link

pesix commented Aug 2, 2024

Problem Statement

We use gRPC to communicate between microservices written in NestJs (see: https://docs.nestjs.com/microservices/grpc). Similar to HTTP communication, we explicitly throw RpcExceptions with a status code for different types of handled exceptions. Since these are not unexpected exceptions, they should not be captured by Sentry.

Solution Brainstorm

Similar to filtering HttpExceptions (#13064), it would be advisable to filter out RpcExceptions as well, because they are thrown explicitly (see: https://docs.nestjs.com/microservices/exception-filters).

@nicohrubec nicohrubec added the Package: nestjs Issues related to the Sentry Nestjs SDK label Aug 2, 2024
@nicohrubec nicohrubec self-assigned this Aug 2, 2024
@nicohrubec
Copy link
Contributor

Hey, thanks for writing in! This definitely makes sense. I have added the issue to the nest tracking issue and will try to have a look in the coming weeks.

@nicohrubec
Copy link
Contributor

Hey, about to merge a PR to address this issue. Should go out with the next release some time this or next week probably.

nicohrubec added a commit that referenced this issue Aug 5, 2024
`RpcExceptions` are always explicitly thrown in nest. Therefore, they
are expected for users and should not be sent to Sentry.

This PR filters these exceptions. In `@sentry/nestjs` we can simply use
`instanceof RpcExceptions` to achieve this. In `@sentry/node` we do not
have access to this class, so we need to check based on a property.

[ref](#13190)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Package: nestjs Issues related to the Sentry Nestjs SDK Type: Improvement
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants