Describe the bug
When using @hono/node-server@1.14.1 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/node-server@1.14.1 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.
Describe the bug
When using
@hono/node-server@1.14.1with Node.js v24.3.0, a warning is logged: "Failed to find Response internal state key." This occurs ingetInternalBodybecause it attempts to accessSymbol(state)onResponseobjects, which is not exposed byundiciin Node.js v24.3.0 (it uses a private#statefield 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 PRTo Reproduce
@hono/node-server@1.14.1and Node.js v24.3.0. (with pnpm create hono@latest)pnpm devwithtsx watch src/index.ts).Failed to find Response internal state key
Expected behavior
No warnings should be logged.
Proposed Fix
The issue is caused by
getInternalBodyrelying onto access the internal state of Response objects. Since undici in Node.js v24.3.0 uses a private #state field, this approach fails.