Eomm / fastify-raw-body

Request raw body
MIT License
44 stars 10 forks source link

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

Closed paolochiodi closed 1 year ago

paolochiodi commented 1 year ago

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 https://github.com/Eomm/fastify-raw-body/blob/84f755fc1f82b5865b34dd3aaef323dbc369dd7a/plugin.js#L61)

This in turn causes an issue that's difficult to debug because the error from raw-body is ignored in https://github.com/Eomm/fastify-raw-body/blob/84f755fc1f82b5865b34dd3aaef323dbc369dd7a/plugin.js#L64-L70, 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