Missing '\r\n' in last boundary of FormData
Bug Description
When we send a POST request containing a FormData with fetch, the server never responds (as if still waiting for data). We end up going into timeout.
Reproducible By
const form = new FormData(); form.append('hash', 'abc123deadbeef');
let timer:any ; const resp = Promise.race([ fetch('http://localhost:3000/api', { method: 'POST', body: form }), new Promise((_,rejection) => timer = setTimeout(rejection, 10000, exception)) ]).finally(() => clearTimeout(timer)) ;
Expected Behavior
The last boundary should end with a new line '\r\n' allowing the server to know that all data has been sent.
Logs & Screenshots
Environment
Node v22.15.0
Thanks for reporting!
Can you provide steps to reproduce? We often need a reproducible example, e.g. some code that allows someone else to recreate your problem by just copying and pasting it. If it involves more than a couple of different file, create a new repository on GitHub and add a link to that.
this looks similar to https://github.com/nodejs/undici/commit/fdeccc23b510bda706f5b62921a72ecdc593bda4
Indeed, it looks very similar... Apparently NodeJS version 22 LTS includes the version 6.9 of the library... Hence the persistence of the problem on my side.
node -p "`node: ${process.version}, undici: ${process.versions.undici}`"
node: v22.15.0, undici: 6.21.2
It seems like the commit didn't make it into the v6.21.2 release
https://github.com/nodejs/undici/pull/4210
We shipped it with 6.21.3
https://github.com/nodejs/undici/releases/tag/v6.21.3