Skip to content

fix: initialize global HTTP dispatcher for proxy support#1070

Open
MaUhlik-cen56998 wants to merge 1 commit intoactions:mainfrom
MaUhlik-cen56998:fix-proxy-issue
Open

fix: initialize global HTTP dispatcher for proxy support#1070
MaUhlik-cen56998 wants to merge 1 commit intoactions:mainfrom
MaUhlik-cen56998:fix-proxy-issue

Conversation

@MaUhlik-cen56998
Copy link

This PR fixes proxy handling for Node 20 native fetch() by initializing an undici global dispatcher when proxy environment variables are present.

In proxy-restricted environments, dependency review calls may fail unless undici/fetch is explicitly configured to use a proxy dispatcher. This change ensures outbound HTTP requests honor common proxy environment configuration.

@MaUhlik-cen56998 MaUhlik-cen56998 requested a review from a team as a code owner March 12, 2026 15:23
Copilot AI review requested due to automatic review settings March 12, 2026 15:23
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds proxy support for outbound HTTP calls made via Node 20’s native fetch() by configuring an undici global dispatcher early in the action lifecycle, improving reliability in proxy-restricted environments.

Changes:

  • Add initializeProxySupport() to configure an undici ProxyAgent from common proxy env vars.
  • Invoke proxy initialization at the start of run() in src/main.ts.
  • Add Jest coverage for proxy env var handling and URL parsing behavior.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
src/proxy.ts New proxy initialization helper that sets undici global dispatcher based on proxy env vars.
src/main.ts Calls proxy initialization early so subsequent fetch() calls can use the proxy.
__tests__/proxy.test.ts Unit tests for proxy env var precedence, auth handling, and invalid URL behavior.

You can also share your feedback on Copilot code review. Take the survey.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.


You can also share your feedback on Copilot code review. Take the survey.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.


You can also share your feedback on Copilot code review. Take the survey.

test: add tests for proxy support initialization

fix: address copilot code review feedback

fix: update undici to version 6.23.0 in package.json and package-lock.json due the GHSA-g9mf-h72j-4rw9

fix: refactor credential decoding in initializeProxySupport for clarity

fix: replace ProxyAgent with EnvHttpProxyAgent for improved proxy support
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants