Skip to content

Fix fetched Headers methods under @types/node - #617

Open
KayleeWilliams wants to merge 1 commit into
vercel-labs:mainfrom
KayleeWilliams:fix/fetched-headers-methods
Open

KayleeWilliams wants to merge 1 commit into
vercel-labs:mainfrom
KayleeWilliams:fix/fetched-headers-methods

Conversation

@KayleeWilliams

Copy link
Copy Markdown

I hit this moving our CLI (inthhq/inth) to 0.2. Our HTTP client reads headers off fetch responses, and with @types/node installed it crashes:

const res = await fetch(url);
res.headers.get("x-request-id");
// TypeError: res.headers.get is not a function

It works on 0.1.7, and without @types/node. undici-types declares Headers methods as properties (readonly get: (name: string) => string | null), so lower-calls.ts reads get off the native handle and calls the result. The handle only answers get as a method, so the read comes back undefined.

This sends members declared by the standard library or @types/node back through dynInvoke, like 0.1.7 did. Callback properties in user code still go through read-then-call.

The new node-types test fetches from a local server and compares with Node. It fails on main and passes with this. The corpus and the fetch tests pass otherwise, except 1640-fd-read-decode.ts, 2283-structured-clone.cjs, stream-from-immediate-cancel, static and static-stream-this, which fail on main for me too (Node 24.19). I didn't run the sanitized lane.

@vercel

vercel Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

@KayleeWilliams is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

This branch has not been deployed

No deployments
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.

1 participant