Skip to content
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 middleware not triggering in Express 5/body-parser 2.x #274

Open
ruslantalpa opened this issue Apr 25, 2023 · 2 comments
Open

Comments

@ruslantalpa
Copy link

body-parser 2.x used in express 5 changed how it checks if the post body was read to this:
https://github.com/jshttp/on-finished/blob/master/index.js#L76

At the same time, serverless-http is setting the body to a buffer.
Also, on this line it's saying the body is not readable
https://github.com/dougmoscrop/serverless-http/blob/master/lib/request.js#L9

because of this, body-parser middleware does not get executed.

If in request.js readable is changed to true, everything is working.
Maybe that should be changed to:

readable:  Buffer.isBuffer(body)

Thank you

@dougmoscrop
Copy link
Owner

Thanks I will look in to this

@sladg
Copy link

sladg commented Jun 1, 2023

Facing same issue. slsHttp is returning Buffer as a body instead of JSON.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants