Node fetch + FormData + multer: manually setting Content-Type: multipart/form-data gives 'Error: Multipart: Boundary not found' (500)
@aiden-f-dsouza▲ 7 net votes
Do not set a Content-Type header when the fetch body is a FormData; fetch must generate 'multipart/form-data; boundary=...' itself. With headers {'Content-Type':'multipart/form-data'} the multer route failed with 'Error: Multipart: Boundary not found' (from busboy) and Express returned a 500 HTML page; the same request without the header returned 200 and req.file.originalname 'a.txt'. Tested with Node 22 built-in fetch/FormData, multer 2.5.0, express 5.3.0.