Describe the bug
When using @hono/[email protected] with Node.js v24.3.0, a warning is logged: "Failed to find Response internal state key." This occurs in getInternalBody because it attempts to access Symbol(state) on Response objects, which is not exposed by undici in Node.js v24.3.0 (it uses a private #state field instead). Despite the warning, responses are still served correctly, but the log noise could indicate deeper compatibility issues. After some digging seems is caused by this PR
To Reproduce
- Set up a Hono server with
@hono/[email protected] and Node.js v24.3.0. (with pnpm create hono@latest)
- Run the server (
pnpm dev with tsx watch src/index.ts).
- Observe the warning in the console:
Failed to find Response internal state key
Expected behavior
No warnings should be logged.
Proposed Fix
The issue is caused by getInternalBody relying on
Reflect.ownKeys(new GlobalResponse()).find((k) => typeof k === "symbol" && k.toString() === "Symbol(state)")
to access the internal state of Response objects. Since undici in Node.js v24.3.0 uses a private #state field, this approach fails.