$fetch with server API endpoint and multipart form data

I can't work out how to send a file from my page to a Nuxt 3 server API endpoint.

  • Bottom-left: page code. Highlighted is the snippet which creates formData and sends it to my api endpoint using $fetch.
  • Bottom-right: the endpoint itself
  • Top: browser console logging from line 147 of page code. Shows the formData has a file and an id.
  • Bottom far-right: no logs in console. Nothing. I can't get it to read data from the request.
If I log a fixed string at the dop of the defineEventHandler function, it will log to the terminal. But if I try and log after trying to run readMultipartFormData, it will not log. I have tried to catch errors from readMultipartFormData and nothing.
image.png
Was this page helpful?