Repository navigation
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: 2327260 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 |
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 732
=======================================
Hits 731 731
Misses 1 1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
zimeg
left a comment
There was a problem hiding this comment.
📝 Small adjustments to words quick-
# Conflicts: # package-lock.json # package.json
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
|
🎉 @githubdev58yashi Thanks so much for tracking this down and for your patience on a review! I pushed a few changes to land this:
🧪 Tests passed on 2327260: unit tests and API and CLI tests. |
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