UNPKG

ai

Version:

AI SDK by Vercel - build apps like ChatGPT, Claude, Gemini, and more with a single interface for any model using the Vercel AI Gateway or go direct to OpenAI, Anthropic, Google, or any other model provider.

33 lines (22 loc) 822 B
--- title: Streaming Not Working When Proxied description: Troubleshooting streaming issues in proxied apps. --- # Streaming Not Working When Proxied ## Issue Streaming with the AI SDK doesn't work in local development environment, or deployed in some proxy environments. Instead of streaming, only the full response is returned after a while. ## Cause The causes of this issue are caused by the proxy middleware. If the middleware is configured to compress the response, it will cause the streaming to fail. ## Solution You can try the following, the solution only affects the streaming API: - add `'Content-Encoding': 'none'` headers ```tsx return createUIMessageStreamResponse({ stream: toUIMessageStream({ stream: result.stream }), headers: { 'Content-Encoding': 'none', }, }); ```