Skip to content

fix: downgrade undici to v6 and add SOCKS proxy support for undici dispatcher path#2802

Draft
Copilot wants to merge 3 commits intomax-regen-genfrom
copilot/sub-pr-2770-please-work
Draft

fix: downgrade undici to v6 and add SOCKS proxy support for undici dispatcher path#2802
Copilot wants to merge 3 commits intomax-regen-genfrom
copilot/sub-pr-2770-please-work

Conversation

Copy link
Contributor

Copilot AI commented Mar 19, 2026

A prior commit ("support socks proxy") accidentally bumped undici from ^6.24.1 to ^7.23.0, breaking Node.js 18 compatibility (File is not defined). undici v7 requires Node.js ≥ 20.18.1.

Changes

  • package.json: Revert undici to ^6.24.1; add socks (^2.8.4) as a direct dependency
  • src/config.ts:
    • Import buildConnector from undici and SocksClient from socks
    • Extend DispatcherOptions with a 'socks' variant ({ type: 'socks'; uri: string; requestTls: tls.ConnectionOptions })
    • In createDispatcherOptions, return { type: 'socks' } for SOCKS proxy URLs instead of throwing
    • Add createSocksConnector() — creates an undici-compatible connector that tunnels connections through the SOCKS proxy using SocksClient.createConnection, with TLS upgrade for https: targets
    • In createDispatcher, handle type: 'socks' by creating a UndiciAgent with the custom socks connector
  • src/config_test.ts: Restore socks proxy test to verify a UndiciAgent is set as the dispatcher and createDispatcherOptions returns { type: 'socks', uri: 'socks5://...' }

SOCKS proxy now works on both the createDispatcher path (undici/fetch) and the legacy createAgent path (WebSocket / applyToHTTPSOptions).


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI mentioned this pull request Mar 19, 2026
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 19, 2026
@k8s-ci-robot k8s-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Mar 19, 2026
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Copilot
Once this PR has been reviewed and has the lgtm label, please ask for approval from brendandburns. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Mar 19, 2026
Copilot AI changed the title [WIP] Regenerate using new openapi generator with undici support fix: downgrade undici to v6 and restore SOCKS proxy error for undici path Mar 19, 2026
Copilot AI requested a review from brendandburns March 19, 2026 21:54
@brendandburns
Copy link
Contributor

@copilot update this to use SocksProxyAgent when the proxy type is socks and restore the test for socks.

…ient connector

Co-authored-by: brendandburns <5751682+brendandburns@users.noreply.github.com>
Agent-Logs-Url: https://github.com/kubernetes-client/javascript/sessions/789ac2b6-243f-4ac2-9786-5e5e23942604
Copy link
Contributor Author

Copilot AI commented Mar 20, 2026

@copilot update this to use SocksProxyAgent when the proxy type is socks and restore the test for socks.

Done in 2152769. The createDispatcher path now supports SOCKS proxies via a custom undici Agent connector (createSocksConnector) that uses SocksClient.createConnection to tunnel connections through the SOCKS proxy, with TLS upgrade for https: targets. Added socks as a direct dependency and a new 'socks' variant to DispatcherOptions. The test is restored to verify UndiciAgent is set as the dispatcher and createDispatcherOptions returns { type: 'socks', uri: 'socks5://example:1187' }.

Copilot AI changed the title fix: downgrade undici to v6 and restore SOCKS proxy error for undici path fix: downgrade undici to v6 and add SOCKS proxy support for undici dispatcher path Mar 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants