Skip to content

Conversation

@mrgrain
Copy link
Contributor

@mrgrain mrgrain commented May 26, 2025

Updates the CdkToolkit and Notices APIs to take a Node https.Agent instead of options. This gives more flexibility to integrators while retaining proxy support. We can make the changes to Notices since it is not a public API.

The CLI changed need to be split out from the toolkit-lib changes, so the latter can be safely marked as breaking without touching CLI files. The respective toolkit-lib changes are in #533

Relates to #398


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@github-actions github-actions bot added the p2 label May 26, 2025
@aws-cdk-automation aws-cdk-automation requested a review from a team May 26, 2025 10:13
@mrgrain mrgrain force-pushed the mrgrain/refactor/cli/externalize-proxy-agent branch from 0659625 to fd9a54c Compare May 26, 2025 10:31
@mrgrain mrgrain temporarily deployed to integ-approval May 26, 2025 10:31 — with GitHub Actions Inactive
@codecov-commenter
Copy link

codecov-commenter commented May 26, 2025

Codecov Report

Attention: Patch coverage is 78.88889% with 19 lines in your changes missing coverage. Please review.

Project coverage is 78.62%. Comparing base (6274e22) to head (11b393a).

Files with missing lines Patch % Lines
packages/aws-cdk/lib/cli/proxy-agent.ts 73.97% 19 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #532      +/-   ##
==========================================
- Coverage   78.65%   78.62%   -0.04%     
==========================================
  Files          46       47       +1     
  Lines        6977     7055      +78     
  Branches      775      783       +8     
==========================================
+ Hits         5488     5547      +59     
- Misses       1470     1489      +19     
  Partials       19       19              
Flag Coverage Δ
suite.unit 78.62% <78.88%> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

…toolkit-lib

Updates the CdkToolkit and Notices APIs to take a Node https.Agent instead of options. This gives more flexibility to integrators while retaining proxy support.

The CLI changed need to be split out from the toolkit-lib changes, so the latter can be safely marked as breaking without touching CLI files.
@mrgrain mrgrain force-pushed the mrgrain/refactor/cli/externalize-proxy-agent branch from fd9a54c to 4fe8dc6 Compare May 26, 2025 10:44
@mrgrain mrgrain temporarily deployed to integ-approval May 26, 2025 10:44 — with GitHub Actions Inactive
@rix0rrr rix0rrr disabled auto-merge May 26, 2025 10:50
* Options for the HTTPS requests made by Notices
*/
readonly httpOptions?: SdkHttpOptions;
readonly httpsOptions?: NoticesHttpsOptions;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you call it httpOptions I'll assume it applies to all flavors of HTTP requests.

If you call it httpsOptions I'll wonder where the httpOptions are.

I see how this is strictly correct but is it helpful?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will revert back.

@mrgrain mrgrain temporarily deployed to integ-approval May 26, 2025 10:55 — with GitHub Actions Inactive
@mrgrain mrgrain added this pull request to the merge queue May 26, 2025
Merged via the queue into main with commit 4767724 May 26, 2025
21 checks passed
@mrgrain mrgrain deleted the mrgrain/refactor/cli/externalize-proxy-agent branch May 26, 2025 14:01
github-merge-queue bot pushed a commit that referenced this pull request May 27, 2025
Fixes #398 
Depends on #532

Previously automatically configured the SDK to pass all requests through
an instance of `ProxyAgent` from the third-party `proxy-agent` package.
A user could configure its proxy settings, but by default it would act
as a pass through. `proxy-agent` is a hefty dependency (primarily due to
its support for `pac` files) that not everyone might want to use. This
is the standard interface in Node.js and we are aligning on it.

Note that with this we are also removing built-in (but not advertised)
support for managing proxy configuration through env vars like
`HTTP_PROXY` or `HTTPS_PROXY`. This functionality was provided by
`proxy-agent` and the easiest way to get it back is by configuring
`proxy-agent` again.

BREAKING CHANGE: Dependency on `proxy-agent` has been removed, this also
removes the support of configuring a proxy through like `HTTPS_PROXY`
and `AWS_CA_BUNDLE`. The type of `sdkConfig.httpOptions` has changed to
now optionally take a single `agent: https.Agent` property instead of
the proxy settings. The restore the previous behavior, pass an instance
of `ProxyAgent` to `sdkConfig.httpOptions`: `{ agent: new ProxyAgent({
ca: oldHttpOptions.caBundlePath, getProxyForUrl: () =>
oldHttpOptions.proxyAddress }) }`

---
By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache-2.0 license
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants