Skip to content

Commit

Permalink
fix: make wrangler work on node v18
Browse files Browse the repository at this point in the history
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
  • Loading branch information
threepointone committed Apr 25, 2022
1 parent b3ad07d commit 5bc41b0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .changeset/eleven-cheetahs-clean.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
"wrangler": patch
---

fix: make wrangler work on node v18

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 https://github.com/cloudflare/wrangler2/issues/834
3 changes: 3 additions & 0 deletions packages/wrangler/bin/wrangler.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ Consider using a Node.js version manager such as https://volta.sh/ or https://gi
wranglerProcess = spawn(
process.execPath,
[
...(semiver(process.versions.node, "18.0.0") >= 0
? ["--no-experimental-fetch"] // TODO: remove this when https://github.com/cloudflare/wrangler2/issues/834 is properly fixed
: []),
"--no-warnings",
"--experimental-vm-modules",
...process.execArgv,
Expand Down

0 comments on commit 5bc41b0

Please sign in to comment.