Fix undici usage on node 26. - #53
Draft
davidlehn wants to merge 2 commits into
Draft
Conversation
A dispatcher is only usable by the undici instance that created it. Node
bundles its own undici (node 22: 6.x, node 24: 7.x, node 26: 8.x) and the
dispatcher handler interface changed between majors, so passing an
installed-undici dispatcher to `globalThis.fetch` fails. undici 7 still
accepted 6.x style handlers, but undici 8 does not, breaking node 26 with
`UND_ERR_INVALID_ARG` ("invalid onError method").
Call undici's own `fetch` instead so the dispatcher and the `fetch` using
it always come from the same module. This works on any node version and
with any installed undici, rather than pinning undici to whichever node
happens to match.
undici's `fetch` does not accept the global `Request` that `ky` passes,
so unpack it into a url and init pair.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2 tasks
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.
This was purely done via asking claude to fix the undici issue on node 26. It had long winded text about issue and did matrix tests of undici and node versions and came up with this fix. Claims update to undici 8 will work too. Needs review.