fix: use undici fetch with Agent to avoid cross-version dispatcher mismatch - #32
Open
govi-deriv wants to merge 1 commit into
Open
fix: use undici fetch with Agent to avoid cross-version dispatcher mismatch#32govi-deriv wants to merge 1 commit into
govi-deriv wants to merge 1 commit into
Conversation
|
I also hit this error today. Temporarily fixed by building a local version with |
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.
Hit this while using the CLI against one of our private Xano instances on Node 26. Metadata API calls were dying right away with:
UND_ERR_INVALID_ARG: invalid onError methodNothing about the private instance itself was wrong — that's just where I noticed it. Anything going through verboseFetch (most workspace/sandbox commands) would have the same problem once Node's bundled undici and the npm dependency get out of sync.
The issue is that we create a custom undici.Agent from npm (undici@6, for the longer timeout stuff) and hand it to global fetch(). But global fetch uses whatever undici ships with Node, and those two don't always play nice together. Undici expects fetch and dispatcher to come from the same install — mix versions and you get the handler API mismatch above.
This PR switches verboseFetch to use undici.fetch from the same package as the Agent. Small change, same behavior everywhere else.
Test plan
Ran metadata commands against the private instance on Node 26 — no more UND_ERR_INVALID_ARG
npm run build passes
Worth a quick smoke test on Node 20/22 if someone has one handy, but the change is isolated to verboseFetch