Skip to content

Missing '\r\n' in last boundary of FormData #4197

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
viwydev opened this issue May 6, 2025 · 4 comments
Open

Missing '\r\n' in last boundary of FormData #4197

viwydev opened this issue May 6, 2025 · 4 comments
Labels
bug Something isn't working

Comments

@viwydev
Copy link

viwydev commented May 6, 2025

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

Image

Environment

Node v22.15.0

@viwydev viwydev added the bug Something isn't working label May 6, 2025
@mcollina
Copy link
Member

mcollina commented May 6, 2025

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.

@KhafraDev
Copy link
Member

this looks similar to fdeccc2

@viwydev
Copy link
Author

viwydev commented May 7, 2025

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.

@KhafraDev
Copy link
Member

KhafraDev commented May 12, 2025

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

#4210

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants