fix: proxy input always fails due to an undici version mismatch - #675
Open
githubdev58yashi wants to merge 1 commit into
Open
fix: proxy input always fails due to an undici version mismatch#675githubdev58yashi wants to merge 1 commit into
githubdev58yashi wants to merge 1 commit into
Conversation
The ProxyAgent dispatcher is built with the npm "undici" package (v8), but was driven by globalThis.fetch, which Node bundles from a different (older) undici version. A breaking change to undici's request handler interface between v7 and v8 made every proxied request fail before any network I/O, regardless of whether the proxy or destination was reachable. Use undici's own exported fetch instead so the dispatcher and the fetch implementation always come from the same undici version.
🦋 Changeset detectedLatest commit: 83c2ce0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
githubdev58yashi
had a problem deploying
to
staging
August 21, 2026 23:17 — with
GitHub Actions
Failure
githubdev58yashi
had a problem deploying
to
staging
August 21, 2026 23:17 — with
GitHub Actions
Failure
githubdev58yashi
had a problem deploying
to
staging
August 21, 2026 23:17 — with
GitHub Actions
Failure
githubdev58yashi
had a problem deploying
to
staging
August 21, 2026 23:17 — with
GitHub Actions
Failure
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #675 +/- ##
=======================================
Coverage 99.86% 99.86%
=======================================
Files 8 8
Lines 732 735 +3
=======================================
+ Hits 731 734 +3
Misses 1 1 ☔ 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.
Summary
Setting the
proxyinput always makes requests fail. It doesn't matter whether the proxy or the destination is actually reachable.The cause is a version mismatch inside undici.
src/proxies.jsbuilds aProxyAgentdispatcher from the npmundicipackage (^8.9.0), but drives it withglobalThis.fetch. On Node 24,globalThis.fetchis backed by a different, older bundled undici (7.21.0). undici made a breaking change to its request handler interface between v7 and v8 (see the v8.0.0 release notes), so the mismatch throws before any network I/O even starts.The fix is to use undici's own exported
fetchinstead of the global one. That keeps the dispatcher and the fetch implementation on the same undici version.This only affects requests made while the
proxyinput is set. The call path issrc/client.js#L26/src/webhook.js#L22→proxies.js.This mismatch was introduced in v4, when both SDKs switched from axios to the Fetch API and this proxy dispatcher started depending on undici (#619). It went unnoticed until a later undici v7 → v8 bump (#653) actually broke it.
Testing
Added a test to
test/proxies.spec.jsthat actually calls the functionfetch()returns, instead of only checking its type. That gap is why the bug went unnoticed — the existing tests never called the returned function. No real server is needed: the mismatch happens synchronously, before any network I/O, so pointing the proxy at a closed local port is enough to catch a regression.Also verified by running the actual packaged action (
dist/index.js,runs.using: node24) throughact(Docker). Before the fix, the underlying cause isInvalidArgumentError UND_ERR_INVALID_ARG invalid onRequestStart method. After the fix, it'sError ECONNREFUSED— a normal network error, since nothing listens on the test proxy port.Log excerpt (before / after)
Before:
After:
The action's own warning/error text looks almost the same before and after, since
SlackErrordoesn't propagate.cause. Thecauseerror type is the reliable way to tell them apart, and that's exactly what the new test checks.Requirements