Can't read multipart/form-data from POST request

I’m trying to setup a webhook callback route.
The webhook source sends a request encoded as multipart/form-data to my endpoint.
I can receive the request but the body is empty.

The data being send consists of:

  • a text property called “id”
  • a pdf property of type “application/pdf” called “pdf”

I have configured the middlewares.ts with:

  {
    name: "strapi::body",
    config: {
      multipart: true,
      includeUnparsed: true,
    },
  },

I’m trying to read the data in my custom controller like this:

console.log("body", ctx.request.body);
console.log("files", ctx.request.files);
console.log("unparsed", unparsed);
console.log(ctx.request.body[unparsed]);

But the output is just:

body { [Symbol(unparsedBody)]: undefined }
files undefined
unparsed Symbol(unparsedBody)
undefined

I also tested with a https://webhook.site/ callback url which is working fine. I get the file and the id.
What am I missing?

This topic has been created from a Discord post (1232340329831862342) to give it more visibility.
It will be on Read-Only mode here.
Join the conversation on Discord

The solution is a broken boundary definition.