You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
On Node 26.11, reading duplex on the lightweight request throws ERR_INVALID_THIS, so new Request(url, c.req.raw) fails #408
Any code that passes the request c.req.raw from @hono/node-server as a RequestInit now throws on Node 26.11. A common example is rewriting the URL before handing the request to an auth library:
Node 26.11.0 updated undici to 8.11.2. undici 8.11.0 includes use private fields for brand checks nodejs/undici#5792 ("use private fields for brand checks"). Since then, the getters on Request.prototype throw unless this is a real undici Request.
The lightweight request in src/request.ts forwards a fixed list of properties to the real request through getRequestCache(): cache, credentials, destination, integrity, mode, redirect, referrer, referrerPolicy and keepalive. duplex is not on that list. Reading duplex therefore falls through to undici's own Request.prototype.duplex getter, which now fails its brand check.
The Request constructor reads init.duplex, so passing the lightweight request as init throws.
Suggested fix
Add duplex to the forwarded properties in src/request.ts:
Two other fixes are possible, depending on what you want to support: forward every remaining Request.prototype getter so that a future undici getter can't hit the same problem, or return the constant 'half'.
you can but maybe shouldn't monkey patch this while you wait for a fix:
// HACK: monkey patch the fix for https://github.com/honojs/node-server/issues/408lethonoHack=falseapp.use(async(c,next)=>{if(!honoHack){honoHack=trueconstrequestPrototype=Object.getPrototypeOf(c.req.raw)constgetRequestCache=Object.getOwnPropertySymbols(requestPrototype).find(s=>/getRequestCache/.test(s.toString()))!Object.defineProperty(requestPrototype,'duplex',{get(){returnthis[getRequestCache]().duplex}})}awaitnext()})
Activity
Ahmad-Mosha commentedon Oct 13, 2026
I was able to reproduce this on Node 26.11.1 (undici 8.11.2), while 26.10.0 works as expected.
I also confirmed that Hono's
app.mount()returns 500 on 26.11.1, since it passes the lightweight request tonew Request(url, request).I'll work on the suggested fix (forwarding
duplexlike the other getters) and add regression tests. I'll open a PR once it's ready.xandris commentedon Oct 14, 2026
you can but maybe shouldn't monkey patch this while you wait for a fix: