-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
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
After upgrading to v9.x.x, throwing error from middleware (fastify) cause application to crash #10781
Comments
from which version of |
Thank you @micalevisk for answer But the github repo link i have posted where issue is reproducible, is brand new small project just showing this behaviour. |
That bug was introduced in 9.1.3, 9.1.2 went fine |
Just ran into this issue myself. I can confirm that pinning our version to We'll upgrade once the internal upgrade to fastify |
the issue is that |
Oh sorry I had that backwards. I thought it was a backwards compatibility issue, not a forwards compatibility one. |
Is there an existing issue for this?
Current behavior
After upgrading nestjs to version 9 (exact one 9.2.1) with using @nestjs/platform-fastify, throwing an error from middleware is causing application to crash.
Using following code in middleware will cause application to crash with below error:
Code:
Error:
For some reason if i do not throw error from middleware, but rather using next callback with passing error, everything seems to be fine, application will not crash and no
preSerialization
error will occur.Code:
Minimum reproduction code
https://github.com/srkimir/nestjs-fastify-preSerialization-error
Steps to reproduce
Expected behavior
Application to handle error, and to respond with BadRequestException which was thrown from middleware.
Package
@nestjs/common
@nestjs/core
@nestjs/microservices
@nestjs/platform-express
@nestjs/platform-fastify
@nestjs/platform-socket.io
@nestjs/platform-ws
@nestjs/testing
@nestjs/websockets
Other package
No response
NestJS version
9.2.1
Packages versions
Node.js version
18.12.1
In which operating systems have you tested?
Other
No response
The text was updated successfully, but these errors were encountered: