Req.body is null (using express, body-parser, aws)

aws
lambda

#1

Hello,

I followed the steps listed in this tutorial: https://serverless.com/blog/serverless-express-rest-api/

For some reason, when I send my POST requests with data, I am unable to access the data.
req.body is null.

My understanding is that there is some “matching” going on within the serverless app, but I don’t see that happening.

Seems like no one else in this forum has had that issue, so I’m sure there’s something simple I’m not doing.
Thank you.


#2

I just figured out my problem. My requests were being sent with the data as “Multi-part form”. I changed it to “Form URL Encoded” and now it works.

I think I need to call
app.use(multer()); in order to add “Multi-part form” data support.

Hope this can help someone who runs into this same silly issue.