fix(cli): fail fast when --proxy has no or an unsupported protocol - #1843
Merged
Conversation
The proxy-agent library only rejects a proxy address with a missing or unsupported protocol lazily, on the first request, so `--proxy localhost:1234` appeared to fail silently (or later with a misleading credentials error) and the real reason was only visible with -vvv. Validate the proxy address up front in ProxyAgentProvider.create() and throw a clear, actionable error, reusing proxy-agent's own supported-protocol map. Fixes aws#453
lemon0333
requested a deployment
to
integ-approval
August 18, 2026 06:40 — with
GitHub Actions
Waiting
aws-cdk-automation
enabled auto-merge
August 18, 2026 06:40
The proxy address setting is unset when no --proxy is given and can surface at runtime as an empty string or empty array; validating it unconditionally broke unrelated commands with a spurious 'Invalid proxy address' error. Guard the validation on a non-empty string.
auto-merge was automatically disabled
August 18, 2026 07:30
Head branch was pushed to by a user without write access
lemon0333
had a problem deploying
to
integ-approval
August 18, 2026 07:30 — with
GitHub Actions
Failure
rix0rrr
approved these changes
Aug 18, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1843 +/- ##
==========================================
+ Coverage 90.31% 90.34% +0.02%
==========================================
Files 80 80
Lines 12159 12195 +36
Branches 1725 1732 +7
==========================================
+ Hits 10982 11018 +36
Misses 1143 1143
Partials 34 34
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Fixes #453
--proxy localhost:1234(a proxy address without a protocol) appeared to fail silently.proxy-agentonly rejects a missing/unsupported protocol lazily, on the first request, so the real error (Unsupported protocol for proxy URL) was only visible with-vvv, and users otherwise saw a misleading downstream failure (e.g. "need credentials").This validates the proxy address up front in
ProxyAgentProvider.create()and throws a clear, actionable error, reusingproxy-agent's own exported supported-protocol map (so the accepted set can't drift):localhost:1234,1.2.3.4:8080) →Invalid proxy address '<addr>': it must be a URL that includes a protocol, e.g. 'http://<addr>'ftp://…) →Unsupported protocol '<proto>' in proxy address '<addr>'. Supported protocols are: …A valid address (
http://…,https://…,socks5://…,pac+http://…) is unchanged. Added unit tests forvalidateProxyAddressandProxyAgentProvider.create()(10 tests, all passing).Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license