Skip to content

TypeError: immutable with incompatible version of @hono/node-server #1389

@mhassan1

Description

@mhassan1

What Happened?

When I use a version of @hono/node-server greater than 1.14.2, I get an error response when calling /v1/chat/completions:

{"status":"failure","message":"Something went wrong"}

In the AI Gateway logs, I see this error:

tryTargetsRecursively error:  immutable undefined TypeError: immutable
    at appendHeader (node:internal/deps/undici/undici:8659:15)
    at _Headers.append (node:internal/deps/undici/undici:8862:16)
    at Fp.updateHeaders (file:///Users/me/projects/github/gateway/build/start-server.js:2:398498)
    at Fp.create (file:///Users/me/projects/github/gateway/build/start-server.js:2:398112)

The behavior may be caused by honojs/node-server#242.

According to the fetch spec, response headers with the immutable header guard can't be modified, which seems to be what the AI Gateway wants to do in updateHeaders.

What Should Have Happened?

When I use a lower version of @hono/node-server, I get a successful response.

Relevant Code Snippet

  1. npx @portkey-ai/gateway (where a version of @hono/node-server greater than 1.14.2 gets installed)
  2. Call Portkey:
curl 'http://localhost:8787/v1/chat/completions' \
  -H 'content-type: application/json' \
  -H 'x-portkey-provider: vertex-ai' \
  -H 'x-portkey-vertex-service-account-json: ...' \
  -H 'x-portkey-vertex-project-id: ...' \
  -H 'x-portkey-vertex-region: global' \
  -d '{
    "model": "gemini-2.5-flash",
    "stream": true,
    "messages": [
      {
        "role": "system",
        "content": "You are a helpful assistant"
      },
      {
        "role": "user",
        "content": "what is a portkey?"
      }
    ]
  }'

Your Twitter/LinkedIn

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions