Skip to content

Node 26/Undici 8 breaks HTTPS_PROXY #870

Description

@quinncomendant

What happened?

Node.js 26 was released May 5, and includes a breaking change in relation to Nono's network proxy.

Node 26's built-in HTTP client (undici 8.x) no longer reads the HTTPS_PROXY environment variable by default. In prior Node versions, apps could call setGlobalDispatcher(new EnvHttpProxyAgent()) at startup to register a proxy-aware HTTP client globally, and both the app's own code and the built-in fetch() would use it. Node 26 broke this by switching to an incompatible internal registry key (undici.globalDispatcher.2 instead of .1), so the proxy-aware client the app registers is invisible to fetch(). The result: fetch() ignores the proxy, connects directly to the destination, and the sandbox blocks it with EPERM.

Setting NODE_USE_ENV_PROXY=1 tells Node 26's built-in fetch() to read HTTPS_PROXY directly, bypassing the broken registry

The main problem is that my pi coding agent was failing, also fixed by setting NODE_USE_ENV_PROXY=1 (and adding it to my profile's allow_vars).

Steps to reproduce

This fails on Node 26:

nono run -s --allow-domain api.z.ai --allow-cwd -- node -e 'fetch("https://api.z.ai/api/anthropic")'

Setting NODE_USE_ENV_PROXY=1 fixes it:

NODE_USE_ENV_PROXY=1 nono run -s --allow-domain api.z.ai --allow-cwd -- node -e 'fetch("https://api.z.ai/api/anthropic")'

Context

Easiest fix: Nono should set NODE_USE_ENV_PROXY=1 automatically when the proxy is active. It used to do this (added in 7271d64) but was removed in 5116fca to "avoid Node-specific flags that can perturb non-Node runtimes". In what way might NODE_USE_ENV_PROXY harm non-Node processes?

nono version

nono 0.50.0

Operating system

macOS

OS version / distro

15.7.5

Kernel version (Linux only)

No response

Profile (if relevant)

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriageNewly opened, not yet reviewed or assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions