#vercel/ai - useChat(onResponse) failing to read response headers

1 messages · Page 1 of 1 (latest)

fast ironBOT
#

Hi @slate bane. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

I'm sorry, but I don't have enough information to provide a confident answer to your question. The knowledge sources provided do not contain specific information about the useChat function from vercel/ai or how to handle its onResponse callback.

However, there are some related issues discussed in the knowledge sources that might be relevant. For example, there's an open issue on GitHub about response headers not being accessible on API routes in Vercel [source] (https://github.com/vercel/next.js/issues/40275). The issue describes a similar problem where headers set in middleware are not accessible in the API routes when the app is deployed to Vercel, even though they work fine locally.

It's also worth noting that one of the comments in this issue mentions that the problem seems to only affect the edge runtime, and switching to the nodejs runtime resolved the issue [source] (https://github.com/vercel/next.js/issues/45371).

I recommend checking these discussions and seeing if they can provide some insight into your problem. If the issue persists, you might want to consider opening a new issue in the vercel/ai repository or reaching out to Vercel support for more specific assistance.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: