Skip to content

fix: use undici fetch with Agent to avoid cross-version dispatcher mismatch - #32

Open
govi-deriv wants to merge 1 commit into
xano-inc:mainfrom
govi-deriv:fix/node-26-undici-fetch
Open

fix: use undici fetch with Agent to avoid cross-version dispatcher mismatch#32
govi-deriv wants to merge 1 commit into
xano-inc:mainfrom
govi-deriv:fix/node-26-undici-fetch

Conversation

@govi-deriv

Copy link
Copy Markdown

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 method

Nothing 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

@max-mapper

Copy link
Copy Markdown

I also hit this error today. Temporarily fixed by building a local version with dispatcher: getRequestDispatcher(timeoutMs), commented out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants