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

bug: node 18 breaks wrangler2 when experimental fetch is enabled #834

Closed
threepointone opened this issue Apr 22, 2022 · 4 comments · Fixed by #1393 or #1336
Closed

bug: node 18 breaks wrangler2 when experimental fetch is enabled #834

threepointone opened this issue Apr 22, 2022 · 4 comments · Fixed by #1393 or #1336
Assignees
Labels
bug Something that isn't working

Comments

@threepointone
Copy link
Contributor

Something about node 18 breaks wrangler's form upload, leading to this error when we try to upload the worker definition

✘ [ERROR] Received a bad response from the API

  Uncaught TypeError: Main module name is not present in bundle.
    at line 0
   [code: 10021]

You can reproduce this by installing node 18, and running either wrangler dev or wrangler publish. All the other api calls seem fine, it's just this one critical api call.

Working on this, filing the issue to get visibility.

@threepointone threepointone self-assigned this Apr 22, 2022
@threepointone threepointone added this to the 2.0 milestone Apr 22, 2022
@jasnell
Copy link
Member

jasnell commented Apr 22, 2022

Strange... it's possible there's some strange interaction with the version of undici that's bundled into 18.0.0 but that would still be weird. Let me know if you're able to narrow it down a bit more and I'll see if I can find the specific change in 18.0.0 that caused it

@JacobMGEvans
Copy link
Contributor

Strange... it's possible there's some strange interaction with the version of undici that's bundled into 18.0.0 but that would still be weird. Let me know if you're able to narrow it down a bit more and I'll see if I can find the specific change in 18.0.0 that caused it

Oh interesting! That is what I was guessing... Figured it would be the least likely cause though.

threepointone added a commit that referenced this issue Apr 25, 2022
There's some interference between our data fetching library `undici` and node 18's new `fetch` and co. (powered by `undici` internally) which replaces the finename pf`File`s attached to `FormData`swith a generic `blob` (likely this code - https://github.com/nodejs/undici/blob/615f6170f4bd39630224c038d1ea5bf505d292af/lib/fetch/formdata.js#L246-L250). It's still not clear why it does so, and it's hard to make an isolated example of this.

Regardless, disabling the new `fetch` functionality makes `undici` use its own base classes, avoiding the problem for now, and unblocking our release. We'll keep investigating and look for a proper fix.

Unblocks #834
threepointone added a commit that referenced this issue Apr 25, 2022
There's some interference between our data fetching library `undici` and node 18's new `fetch` and co. (powered by `undici` internally) which replaces the filename of `File`s attached to `FormData`s with a generic `blob` (likely this code - https://github.com/nodejs/undici/blob/615f6170f4bd39630224c038d1ea5bf505d292af/lib/fetch/formdata.js#L246-L250). It's still not clear why it does so, and it's hard to make an isolated example of this.

Regardless, disabling the new `fetch` functionality makes `undici` use its own base classes, avoiding the problem for now, and unblocking our release. We'll keep investigating and look for a proper fix.

Unblocks #834
threepointone added a commit that referenced this issue Apr 25, 2022
There's some interference between our data fetching library `undici` and node 18's new `fetch` and co. (powered by `undici` internally) which replaces the filename of `File`s attached to `FormData`s with a generic `blob` (likely this code - https://github.com/nodejs/undici/blob/615f6170f4bd39630224c038d1ea5bf505d292af/lib/fetch/formdata.js#L246-L250). It's still not clear why it does so, and it's hard to make an isolated example of this.

Regardless, disabling the new `fetch` functionality makes `undici` use its own base classes, avoiding the problem for now, and unblocking our release. We'll keep investigating and look for a proper fix.

Unblocks #834
@threepointone threepointone changed the title bug: node 18 breaks wrangler2 bug: node 18 breaks wrangler2 when experimental fetch is enabled Apr 25, 2022
@threepointone
Copy link
Contributor Author

I landed a workaround that adds --no-experimental-fetch for node 18 for now, so this unblocks the release. Will keep investigating.

@threepointone threepointone modified the milestones: 2.0, 2.1 Apr 25, 2022
@threepointone threepointone removed their assignment Apr 25, 2022
@petebacondarwin petebacondarwin modified the milestones: Selected for development, Backlog May 15, 2022
@petebacondarwin petebacondarwin added bug Something that isn't working and removed type: bug labels May 16, 2022
threepointone added a commit that referenced this issue Jul 2, 2022
We'd previously had some funny behaviour with undici clashing with node's own fetch supporting classes, and had turned off node's fetch implementation. Recent updates to undici appear to have fixed the issue, so let's turn it back on.

Closes #834
threepointone added a commit that referenced this issue Jul 2, 2022
We'd previously had some funny behaviour with undici clashing with node's own fetch supporting classes, and had turned off node's fetch implementation. Recent updates to undici appear to have fixed the issue, so let's turn it back on.

Closes #834
@threepointone threepointone self-assigned this Jul 2, 2022
@Peru-S Peru-S mentioned this issue Aug 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that isn't working
Projects
Archived in project
4 participants