fix(cli): honor HTTP_PROXY/HTTPS_PROXY for Node.js native fetch#212
Open
dhruvkej9 wants to merge 1 commit into
Open
fix(cli): honor HTTP_PROXY/HTTPS_PROXY for Node.js native fetch#212dhruvkej9 wants to merge 1 commit into
dhruvkej9 wants to merge 1 commit into
Conversation
Node native fetch ignores proxy env vars by default. In corporate proxy environments (e.g. Zscaler) this causes connect timeouts for all backend calls because traffic bypasses the configured proxy. - Add @githits/core-internal/shared/proxy-fetch with configureProxyAwareFetch() using undici EnvHttpProxyAgent to read HTTP_PROXY/HTTPS_PROXY/NO_PROXY. - Call configureProxyAwareFetch() at the top of src/cli.ts before any network work, and inside createContainer() so MCP and programmatic usage are covered. - Add unit tests for hasProxyEnv and configureProxyAwareFetch. - Add undici ^8.5.0 as a dependency.
Author
Contributor
|
@dhruvkej9 I'm sorry but we don't have CLA in place and cannot yet accept external contributions. But I'll check if I could add support soonish. You can also use GitHits with remote MCP which would hopefully unblock you right now: https://docs.githits.com/installation/manual-setup. |
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.
Problem
Node.js native
fetchignoresHTTP_PROXY/HTTPS_PROXYby default. In corporate proxy environments (e.g. Zscaler), this causes connect timeouts like:curlworks in the same terminal because curl reads proxy env vars; Node does not.Solution
Use undici's
EnvHttpProxyAgentto globally configure Node native fetch whenHTTP_PROXY/HTTPS_PROXYis present. This honorsNO_PROXYtoo.Changes
@githits/core-internal/shared/proxy-fetch.tswithconfigureProxyAwareFetch()/hasProxyEnv().configureProxyAwareFetch()at the top ofsrc/cli.tsbefore any network request.configureProxyAwareFetch()insidecreateContainer()so MCP server and programmatic usage are covered.packages/core-internal/src/shared/proxy-fetch.test.ts.undici ^8.5.0dependency and updatebun.lock.Verification
bun run typecheckpasses.bun run lintpasses (one pre-existing warning insrc/commands/init/agent-definitions.ts).bun test packages/core-internal/src/shared/proxy-fetch.test.ts src/container.test.tspasses.bun run buildsucceeds.Fixes timeout errors for users behind corporate proxies.