banze
banze11mo ago

ReferenceError: FormData is not defined

I am using the experimental form data as shown in the examples and it works correctly on my machine, but when deploying to DigitalOcean App Platform, I get the error you see below. ReferenceError: FormData is not defined in /node_modules/@trpc/server/dist/adapters/node-http/content-type/form-data/index.mjs for:
const formData = new FormData();
const parts = streamMultipart(Readable.toWeb(request), boundary);
const formData = new FormData();
const parts = streamMultipart(Readable.toWeb(request), boundary);
Can anyone save me?
1 Reply
Alex / KATT 🐱
Alex / KATT 🐱11mo ago
probably using an old version of node, you can likely polyfill formdata like this https://github.com/node-fetch/node-fetch#providing-global-access i think node-fetch provides formdata too