Skip to content

fastify-raw-body doesn't respect the bodyLimit set at route level #35

@paolochiodi

Description

@paolochiodi

Hi,
we have a route that uses fastfy-raw-body and sets a bigger bodyLimit on a single route, but fastify-raw-body does not respect it and instead keep using the smaller fastify default bodyLimit (see

limit: fastify.initialConfig.bodyLimit, // limit to avoid memory leak or DoS
)

This in turn causes an issue that's difficult to debug because the error from raw-body is ignored in

if (err) {
/**
* the error is managed by fastify server
* so the request object will not have any
* `body` parsed
*/
return
, but fastify is not actually raising nor returning any error as the limit is bigger.

As a result of this, the requests just hangs up without ever responding to the client.

I have a created a reduced test case at https://gist.github.com/paolochiodi/7176009653df985ddcd33e51fecb4959

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions