-
-
Notifications
You must be signed in to change notification settings - Fork 7.7k
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
Body-parser errors always transformed to 500 #5191
Comments
From @jmcdo29 in discord:
My filter until this is added to the framework: https://gist.github.com/tomasAlabes/249229f97e22774b4ab9682105ce2ca6 |
` export const jsonBodyParser = (options?: OptionsJson) => ( ` |
how to fix it ? "request entity too large" |
It’s custom body parser middleware |
Let's track this here #5990 |
Bug Report
Current behavior
If you send a payload that is too big for body-parser, it should respond with a HTTP code 413. But Nest's
Base Exception Filter
is considering BP's exception as an unknown error, hence wrapping it in a500 Internal Server Error
.Input Code
Vanilla Nest app with body-parser enabled. I can't paste the "too big" request.
Expected behavior
As body-parser and cors are part of Nest core functionality, the errors thrown by them should be honored by the app.
Possible Solution
Special check for cors/body-parser exceptions?
A special exception handler that comes with
platform-express
that understands express middleware?Duck typing to see if the exception comes with a http status or error code?
Environment
Nest version: 7.4.2
For Tooling issues:
Others:
Using @nestjs/graphql but it doesn't even get to that layer.
The text was updated successfully, but these errors were encountered: