mollie / mollie-api-node

Official Mollie API client for Node
http://www.mollie.com
BSD 3-Clause "New" or "Revised" License
231 stars 63 forks source link

Not getting Id from webhook #275

Closed SamEchten closed 2 years ago

SamEchten commented 2 years ago

Hello,

When I try to retrieve the id from my webhook route I am not able to get the Id from anywhere, the body of my request is totally empty. I am using NodeJS express. Does anyone have any idea on how to fix this?

The router -> router The controller -> req body id The body / request -> body

Pimm commented 2 years ago

The body of the request doesn't seem empty; it seems to be an empty object ({}). My initial instinct says that you might have some middleware in there which attempts to parse the raw body of the request as JSON, which it isn't. It is URL encoded.

Please make sure you have the correct body parsing middleware in place. If you feel like you have the correct middleware wired up, please share a complete example, including all of the Express-related code as well as the version of Express you're using.

SamEchten commented 2 years ago

It was indeed my body parsing middleware that was the problem, I now used express.urlencoded(), this fixed the issue. Thanks for the reply!