Type 'FormData' is not assignable to type 'BodyInit'.

Type 'FormData' is not assignable to type 'BodyInit'.
Type 'FormData' is missing the following properties from type 'URLSearchParams': delete, get, getAll, has, and 7 more.
Hi, I get this error when use form-data with native fetch of NextJS, How can I fix this?
Hit the same issue when calling the native fetch as part of VSCode extension development. Any help?
I have the same error, no updates yet ?
2 years later no response?
please help me, i have the same problem.
Using getBuffer method of FormData should help:
body: formData.getBuffer()
@IRediTOTO
Since I use NextJS too, I found its server-side runtime providing FormData (and fetch) polyfill.
So we could directely use new FormData() on the server-side code seamlessly.
- Refer: https://github.com/vercel/next.js/blob/27953213f8f0a8bce3ee17922256b3db40a2c639/packages/next/src/compiled/%40edge-runtime/primitives/fetch.js.LEGAL.txt#L4
For others:
- Node v18 add
FormDataAPI native support - NextJS using
formdata-polyfillhttps://github.com/jimmywarting/FormData too? - Maybe using
formdata-nodehttps://github.com/octet-stream/form-data