gateway
gateway copied to clipboard
`TypeError: immutable` with incompatible version of `@hono/node-server`
trafficstars
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 https://github.com/honojs/node-server/pull/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
npx @portkey-ai/gateway(where a version of@hono/node-servergreater than1.14.2gets installed)- 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