-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
setupNestErrorHandler does not work properly within a NestJS + GraphQL application #12128
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
Comments
Thanks for reporting this @Blargel! It looks like GraphQL does not work well with I have tried to update your setup as, async function bootstrap(): Promise<void> {
const app = await NestFactory.create(AppModule)
Sentry.setupNestErrorHandler(
app,
new ExternalExceptionFilter(),
)
await app.listen(config.port)
} And it seemed to work. Could you check if that resolves the issue? If so we may need to add a note in the docs about this. |
Hmmmm, that works in the test repo I put in my bug report, but it's not working on my actual application. The same TypeError as before is still being thrown. Let me get back to you on this when I figure out what's different. |
Oops, nevermind it works. Maybe something weird got cached. Anyways, that does fix my issue then. Thanks! Should I leave this open to track documentation updates? |
Great that we found a solution - I'll close the issue, users can (hopefully) still find it if they search! 🙏 |
It stopped throwring the If I comment
|
I have solved the issue by creating custom exception filter:
Then you can use this filter when initializing Sentry:
|
Is there an existing issue for this?
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/node
SDK Version
8.2.1
Framework Version
@nestjs/core@10.3.8, @nestjs/graphql@12.1.1
Link to Sentry event
No response
SDK Setup
Steps to Reproduce
npm install
src/main.ts
and change the DSN const to something valid.npm start
query {hello}
.TypeError
is raised and the original error is not sent to Sentry correctly.Expected Result
The GraphQL error should also be reported to Sentry without raising the strange TypeError.
Actual Result
No error reported in Sentry and the following error is thrown:
The text was updated successfully, but these errors were encountered: