Fix: honor HTTPS_PROXY/HTTP_PROXY in proxy-only environments#89
Merged
zdavis-rollbar merged 3 commits intomainfrom Apr 17, 2026
Merged
Fix: honor HTTPS_PROXY/HTTP_PROXY in proxy-only environments#89zdavis-rollbar merged 3 commits intomainfrom
zdavis-rollbar merged 3 commits intomainfrom
Conversation
Node.js built-in fetch (undici) does not respect HTTP_PROXY/HTTPS_PROXY environment variables, causing EAI_AGAIN DNS failures in proxy-only environments (corporate networks, containerized sandboxes, Claude Code remote). Adds undici as an explicit dependency and installs a ProxyAgent as the global fetch dispatcher at startup when any proxy env var is detected. Closes #83 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
brianr
approved these changes
Apr 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
EAI_AGAINDNS failures in proxy-only environments (corporate networks, containerized sandboxes, Claude Code remote) where Node.jsfetch(undici) silently ignoresHTTPS_PROXY/HTTP_PROXYenv varsundicias an explicit dependency and installs aProxyAgentas the global fetch dispatcher at startup when any proxy env var is detected (HTTPS_PROXY,HTTP_PROXY,https_proxy,http_proxy)Closes #83
How it works
A new
src/utils/proxy.tsmodule is imported at the top ofsrc/index.ts(before anyfetch()calls). If a proxy env var is present, it callssetGlobalDispatcher(new ProxyAgent(url)), which makes all subsequentfetch()calls route through the proxy automatically.undiciis added as an explicit npm dependency for Node 20 compatibility —node:undiciis only available from Node 22+, and the project targets>=20.Test plan
tests/unit/utils/proxy.test.tscovering all four proxy env vars, priority ordering, and the no-proxy caseHTTPS_PROXY=http://localhost:9999 node build/index.jsproducesECONNREFUSED(proxy attempted) rather thanEAI_AGAIN(DNS failure) — confirming proxy routing is active--dns=0.0.0.0(DNS blocked) and a real proxy on the host — traffic routes through the proxy successfully🤖 Generated with Claude Code