Skip to content

Commit

Permalink
fix(wrangler): Show wrangler pages dev --proxy warning
Browse files Browse the repository at this point in the history
On Node.js 17+, wrangler will default to fetching only
the IPv6 address. With these changes we warn users that
the process listening on the port specified via `--proxy`
should be configured for IPv6.
  • Loading branch information
CarmenPopoviciu committed Oct 21, 2024
1 parent c794935 commit b62b68c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .changeset/odd-months-bake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"wrangler": patch
---

Show `wrangler pages dev --proxy` warning

On Node.js 17+, wrangler will default to fetching only the IPv6 address. With these changes we warn users that the process listening on the port specified via `--proxy` should be configured for IPv6.
8 changes: 8 additions & 0 deletions fixtures/pages-dev-proxy-with-script/tests/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ describe("Pages dev with proxy and a script file", () => {
"Specifying a `-- <command>` or `--proxy` is deprecated and will be removed in a future version of Wrangler."
)
).toBeTruthy();

expect(
process
.getOutput()
.includes(
"On Node.js 17+, wrangler will default to fetching only the IPv6 address. Please ensure that the process listening on the port specified via `--proxy` is configured for IPv6."
)
).toBeTruthy();
});

it("should handle requests using a script from a custom script path", async () => {
Expand Down
5 changes: 5 additions & 0 deletions packages/wrangler/src/pages/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1000,6 +1000,11 @@ async function spawnProxyProcess({
`Specifying a \`-- <command>\` or \`--proxy\` is deprecated and will be removed in a future version of Wrangler.\nBuild your application to a directory and run the \`wrangler pages dev <directory>\` instead.\nThis results in a more faithful emulation of production behavior.`
);
}
if (port !== undefined) {
logger.warn(
"On Node.js 17+, wrangler will default to fetching only the IPv6 address. Please ensure that the process listening on the port specified via `--proxy` is configured for IPv6."
);
}
if (command.length === 0) {
if (port !== undefined) {
return port;
Expand Down

0 comments on commit b62b68c

Please sign in to comment.