-
Hi, using Nextjs 14.0.2 with the latest version of the Vercel AI SDK. Streaming is not working, expect locally. My code is basically the same as the official example. On my local system, everything works fined, in development and production mode. If I access the site from a different server on the same network, streaming doesn't work. In the Chrome Dev Tools, Network tab, the requests to the API endpoint /api/chat stay on "Pending", until the complete response is ready, then is updated on the website. I tried adding export const maxDuration = 30 almost everywhere (layout.tsx, page.tsx, route.tsx), but this doesn't change anything. Any further suggestions I could try? Greetings, |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 9 replies
-
please check out https://sdk.vercel.ai/docs/troubleshooting/common-issues/streaming-not-working-on-vercel |
Beta Was this translation helpful? Give feedback.
-
And one final note: I build my custom hooks for openai and gemini, which stream just perfect. There must be some issue with vercels ai sdk, that's causing the problem. Also, I'm not the only one, as a quick google search reveals. |
Beta Was this translation helpful? Give feedback.
After further testing, I have determined that the streaming issue is likely due to a problem with the client’s Windows configuration, possibly related to CORS. I will need to consult with our server department to investigate this further. Using a different client, such as an iPad or iPhone on our local network, the streaming works fine. Initially, I ruled out this possibility, which was my mistake. I am closing this issue for now. If I discover the cause, I will update this post.