Next.js Discord

Discord Forum

Proxy FormData from frontend -> api route -> backend api

Unanswered
English Springer Spaniel posted this in #help-forum
Open in Discord
English Springer SpanielOP
Hi,

I am trying to submit FormData from frontend form, into /api route and then take the same data from there and send it to our backend API which is set-up to take multipart/form-data

For some reason, the boundary gets messed up. So i tried to read the request as req.arrayBuffer() and then POST with body: Buffer.from(arrayBuffer) but Vercel failed with:

[TypeError: fetch failed] {
  [cause]: TypeError: Cannot perform ArrayBuffer.prototype.slice on a detached ArrayBuffer at ArrayBuffer.slice 
}


What's the best approach to doing this?

0 Replies