Repository navigation
Description
Summary
On Node.js 26, every Vercel CLI command fails with TypeError: fetch failed as soon as any proxy environment variable is present.
dist/index.js installs a global fetch dispatcher whenever a proxy env var exists:
function hasProxyConfig(){return["HTTP_PROXY","HTTPS_PROXY","http_proxy","https_proxy","ALL_PROXY","all_proxy"].some(v=>process.env[v])}
// ...
if (hasProxyConfig()) {
const { EnvProxyDispatcher } = await import("./chunks/fetch-proxy-<hash>.js");
setFetchDispatcher(new EnvProxyDispatcher);
}EnvProxyDispatcher is built on the CLI's bundled [email protected] (Agent / ProxyAgent). That dispatcher is then handed to Node's built-in fetch. Node 24 embeds undici 7.x and accepts it; Node 26 embeds undici 8.x, which removed legacy handler wrappers in v8.0.0, so the v5 dispatcher rejects the new handler shape.
Root error (unwrapped cause):
TypeError: fetch failed
cause: UND_ERR_INVALID_ARG: invalid onError method
Reproduction
With HTTPS_PROXY (or any of the six names above) pointing at a working proxy:
$ vercel whoami # Node 26.8.2
Error: An unexpected error occurred in whoami: TypeError: fetch failed
Minimal, without the CLI:
// Node 26.8.2, using [email protected] as bundled by the CLI
import { ProxyAgent } from 'undici'; // 5.29.0
await fetch('https://api.vercel.com/v2/user', { dispatcher: new ProxyAgent(process.env.https_proxy) });
// -> TypeError: fetch failed { cause: UND_ERR_INVALID_ARG: invalid onError method }
await new ProxyAgent(process.env.https_proxy).request({ origin: 'https://api.vercel.com', path: '/v2/user', method: 'GET' });
// -> 403 (the proxy itself works fine)Node's own proxy support works on the same machine, same proxy:
$ NODE_USE_ENV_PROXY=1 node -e 'fetch("https://api.vercel.com/v2/user").then(r=>console.log(r.status))'
403
Environment
| CLI | 59.18.0 and 59.23.1 (latest) — both resolve [email protected]; packages/cli/package.json on main pins "undici": "5.29.0" |
| Fails | Node 26.8.2 — process.versions.undici = 8.10.2 |
| Works | Node 24.21.0 — process.versions.undici = 7.29.1 |
| OS | macOS (arm64) |
| Proxy | local HTTP proxy with basic auth; no_proxy does not cover api.vercel.com |
packages/cli/package.json declares "engines": { "node": ">= 18" }, so Node 26 is inside the supported range.
Notes
- This is not proxy-specific in its mechanism:
EnvProxyDispatcher'sdirectAgentis also an undici 5Agent, so oncehasProxyConfig()is true, even requests thatno_proxyexcludes go through a v5 dispatcher. - There is no documented way to opt out of the shim; the only inputs are
all_proxy/http_proxy/https_proxy/no_proxy. --debugonly printsTypeError: fetch failedand retries; thecauseis not surfaced, which makes this look like a network/sandbox problem.
Suggested fixes
- Bump the bundled
undicito^8(or to a version whose dispatcher handler shape matches the Node versions inengines). - Or skip the custom dispatcher when the runtime provides proxy support natively — Node's
--use-env-proxy/NODE_USE_ENV_PROXY(added v24.5.0 / v22.21.0) already parsesHTTP_PROXY,HTTPS_PROXYandNO_PROXYat startup. - Independently: surface
error.causein the CLI's error output so this fails loudly instead of as a genericfetch failed.
Activity
MadKangYu commentedon Sep 18, 2026
Re-verified after upgrading to the current
latest:So 59.23.1 reproduces it as well — the installed dependency tree still resolves
[email protected], matching the pin inpackages/cli/package.jsononmain. Same machine, same proxy, Node 24.21.0 (process.versions.undici7.29.1) still works.vex-7-agent commentedon Sep 22, 2026
Same class as n8n's Qdrant node (#37903, closed 2026-09-08): a dispatcher built from one undici major handed to a fetch backed by another. Three things that may help the review.
Coverage on main. In
packages/cli/srcandpackages/client/srcat c628be7, exactly two sites hand a dispatcher to a fetch:util/fetch.ts(the module-levelfetchDispatcher) andclient/src/utils/index.ts(fetchApi'sopts.dispatcher). Every other caller reaches one of those — the client'sdeploy/upload/continue/check-deployment-statuspass the dispatcher intofetchApi, and the CLI'sprocess-deployment/redeploypassgetFetchDispatcher()into the client.directFetchdeliberately deletes it for loopback. So the two changes in #17634 look like they cover the surface.Where the boundary is. I could not reproduce the throw below undici 8: a dispatcher built by
[email protected]handed to native fetch on Node 22.23.1 (process.versions.undici6.27.0) is accepted. With your Node 24 data point, that puts the break at the undici 8 boundary, i.e. Node 26 only.Same class, other repair. n8n fixed the identical fault by aligning the major (dropping its
undiciv6 catalog pin, PR #37758) rather than routing around it. Both work. Routing through the bundled undici has the smaller blast radius, which reads better to me here.For anyone arriving at the bare symptom:
TypeError: fetch failedwithcause: invalid onError methodis the dispatcher mismatch, not the proxy. Checknode -p "process.versions.undici"and unwrap the cause. I wrote the class up with the boundary and both repair shapes: https://github.com/vex-7-agent/vex-7-agent/blob/main/field-notes/undici-dispatcher-major-mismatch.md