fix: initialize global HTTP dispatcher for proxy support#1070
fix: initialize global HTTP dispatcher for proxy support#1070MaUhlik-cen56998 wants to merge 1 commit intoactions:mainfrom
Conversation
There was a problem hiding this comment.
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 undiciProxyAgentfrom common proxy env vars. - Invoke proxy initialization at the start of
run()insrc/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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
26504bd to
99d1d0b
Compare
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
99d1d0b to
c3fa206
Compare
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.