Bug Description
Once I upgraded to undici 8.0.0 my fetch requests that require going through our corperate proxy stopped working.
I use setGlobalDispatcher(new EnvHttpProxyAgent()) and verified that it's still working on 7.24.7 by downgrading and trying again.
Reproducible By
(Be behind a corperate proxy and have the required proxy settings in your environment variables)
Install undici 8.0.0 and create a javascript file with the following code:
import { EnvHttpProxyAgent, setGlobalDispatcher } from "undici";
async function runTest() {
setGlobalDispatcher(new EnvHttpProxyAgent());
const response = await fetch("https://google.com");
console.log(await response.text());
}
runTest();
Run the file using node <path-to-file> and watch it fail due to a time out.
You may run the test again with undici 7.24.7 and watch it work.
Expected Behavior
Fetch respects the proxy environment variables (like in undici 7.24.7) and the console logs the response from the fetched url.
Logs & Screenshots
undici 8.0.0:
(Use `node --trace-warnings ...` to show where the warning was created)
(node:24328) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
node:internal/process/promises:332
triggerUncaughtException(err, true /* fromPromise */);
^
[TypeError: fetch failed] {
[cause]: ConnectTimeoutError: Connect Timeout Error (attempted addresses: 142.251.110.113:443, 142.251.110.100:443, 142.251.110.138:443, 142.251.110.101:443, 142.251.110.102:443, 142.251.110.139:443, timeout: 10000ms)
at onConnectTimeout (node:internal/deps/undici/undici:1981:23)
at Immediate._onImmediate (node:internal/deps/undici/undici:1947:35)
at process.processImmediate (node:internal/timers:504:21) {
code: 'UND_ERR_CONNECT_TIMEOUT'
}
}
Node.js v25.9.0
undici 7.24.7:
(node:30832) [MODULE_TYPELESS_PACKAGE_JSON] Warning: Module type of file:///C:/Users/DerichSv/Offline/development/projects/products/cgn-gpt/apps/frontend/test-undici.js is not specified and it doesn't parse as CommonJS.
Reparsing as ES module because module syntax was detected. This incurs a performance overhead.
To eliminate this warning, add "type": "module" to C:\Users\DerichSv\Offline\development\projects\products\cgn-gpt\apps\frontend\package.json.
(Use `node --trace-warnings ...` to show where the warning was created)
(node:30832) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
<!doctype html><html itemscope="" itemtype="http://schema.org/WebPage" lang="de"><head><meta content="text/html; charset=UTF-8" http-equiv="Content-Type"><meta content="/images/branding/googleg/1x/googleg_standard_color_128dp.png" itemprop="image"><title>Google</title>
[...]
</script></body></html>
Environment
Windows 11 Enterprise (25H2 26200.7985)
Node v25.9.0
Additional context
Originally noticed the bug in my Next.js application
Bug Description
Once I upgraded to undici 8.0.0 my fetch requests that require going through our corperate proxy stopped working.
I use
setGlobalDispatcher(new EnvHttpProxyAgent())and verified that it's still working on 7.24.7 by downgrading and trying again.Reproducible By
(Be behind a corperate proxy and have the required proxy settings in your environment variables)
Install undici 8.0.0 and create a javascript file with the following code:
Run the file using
node <path-to-file>and watch it fail due to a time out.You may run the test again with undici 7.24.7 and watch it work.
Expected Behavior
Fetch respects the proxy environment variables (like in undici 7.24.7) and the console logs the response from the fetched url.
Logs & Screenshots
undici 8.0.0:
undici 7.24.7:
Environment
Windows 11 Enterprise (25H2 26200.7985)
Node v25.9.0
Additional context
Originally noticed the bug in my Next.js application