Skip to content
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

dispatchFetch does not accept node 18+ builtin FormData object #351

Closed
yusefnapora opened this issue Aug 30, 2022 · 2 comments
Closed

dispatchFetch does not accept node 18+ builtin FormData object #351

yusefnapora opened this issue Aug 30, 2022 · 2 comments
Labels
dependency Issue in dependency
Milestone

Comments

@yusefnapora
Copy link
Contributor

Hey, I'm in the midst of updating a project to use miniflare 2.7 and found that passing a FormData object that's builtin to node 18 as the body of a dispatchFetch request no longer works. This was working prior to 2.7, so I'm assuming it's related to the new version of undici that got pulled in.

Importing FormData from undici instead of using the global one works, which is what I've done in the linked PR. But perhaps there's a way to get undici to recognize other FormData implementations? I haven't looked at undici's internals yet, so I don't know if that's possible.

We're also using a polyfill lib called @web-std/form-data that we maintain in-house, which also worked with miniflare 2.6 and below but no longer works with 2.7. We're thinking about updating it to use undici's FormData, which should solve the issue there, but if there's a simple way to get the existing implementation to play nice with miniflare that would be cool too.

@yusefnapora
Copy link
Contributor Author

I should probably define "no longer works" 😄

If you give dispatchFetch the wrong kind of FormData, it seems to treat it as plain text, setting the content-type to text/plain;charset=utf-8 instead of multipart/form-data.

@mrbbot
Copy link
Contributor

mrbbot commented Sep 11, 2022

Hey! 👋 Looks like this is indeed an issue in undici. I've opened a PR to fix it. 👍

@mrbbot mrbbot added dependency Issue in dependency and removed bug Something isn't working labels Sep 11, 2022
@mrbbot mrbbot modified the milestones: 2.9.0, 2.10.0 Sep 20, 2022
@penalosa penalosa moved this to Untriaged in workers-sdk Sep 20, 2022
@mrbbot mrbbot modified the milestones: 2.10.0, 2.11.0 Oct 11, 2022
@mrbbot mrbbot modified the milestones: 2.11.0, 2.12.0 Dec 22, 2022
@mrbbot mrbbot closed this as completed in f3f1ae9 Dec 23, 2022
Repository owner moved this from Untriaged to Done in workers-sdk Dec 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependency Issue in dependency
Projects
None yet
Development

No branches or pull requests

2 participants