Skip to content

Failed to find Response internal state key" Warning in Node.js v24.3.0 due to undici changes #254

Closed

Description

@Dantescur

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

  1. Set up a Hono server with @hono/node-server@1.14.1 and Node.js v24.3.0. (with pnpm create hono@latest)
  2. Run the server (pnpm dev with tsx watch src/index.ts).
  3. 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.

Activity

  1. usualoma commented on Jul 19, 2025

    @usualoma
    Member

    Hi @Dantescur, thank you for your feedback.

    This issue has been fixed in #242 and will not happen in releases https://github.com/honojs/node-server/releases/tag/v1.14.2 and later. Please try updating.

  2. Dantescur commented on Jul 19, 2025

    @Dantescur
    Author

    Hi @usualoma
    Confirmed, the warning is gone after updating to v1.14.2. Thanks for the great job!

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions