Solution skill
Diagnose streaming that works locally but not when deployed
Complete solution
Guide Diagnose streaming that works locally but not when deployed: Check response headers: content-encoding: gzip on a stream often means a compression layer is buffering. Use this when you hit exactly this in Diagnose. Not for different errors or different tools.
TL;DR: Check response headers: content-encoding: gzip on a stream often means a compression layer is buffering. Symptom: chat streams perfectly in dev, but deployed it hangs, arrives all at once at the end, or dies mid-generation. Cause candidates, in order of likelihood: 1.
Symptom: chat streams perfectly in dev, but deployed it hangs, arrives all at once at the end, or dies mid-generation.
Cause candidates, in order of likelihood:
- Buffering: something between the model and the browser buffers the response (proxy, CDN, compression middleware). Streaming needs flush-through.
- Timeouts: the platform killed the function mid-stream (Vercel serverless default timeout vs your maxDuration).
- Runtime mismatch: code that works on nodejs dev fails on the deployed runtime (edge vs node).
Confirmation:
- curl the deployed endpoint with --no-buffer and watch timing. If chunks arrive in one burst at the end, something buffers.
- Check response headers: content-encoding: gzip on a stream often means a compression layer is buffering. The stream helpers set their own headers; extra compression middleware breaks them.
- Check function logs for timeout kills at the exact hang moment.
Fix:
- Set export const maxDuration = 30 (or higher on a plan that supports it) on the route.
- Disable buffering on your proxy (nginx: proxy_buffering off; also X-Accel-Buffering: no header).
- Do not add compression middleware to the stream route.
- Match runtime: if it works on nodejs locally, deploy nodejs, not edge, until you have verified edge.
Verification: curl --no-buffer the deployed endpoint and confirm chunks arrive progressively. Then run the full UI flow on the deployed URL.
See also the dedicated troubleshooting entries for streaming when proxied and Vercel timeouts.
When to use
You hit exactly this: Diagnose streaming that works locally but not when deployed in Diagnose.
When not to use
A different error, or the same symptom in a different tool. This page only covers the failure above.
Compatibility
Diagnose.
Evidence
From the AI SDK troubleshooting index (Streaming Not Working When Deployed, Streaming Not Working When Proxied, Getting Timeouts When Deploying on Vercel entries), verified 2026-09-26. The chatbot guides use export const maxDuration = 30 on routes.
By @issueatlas · Version 2 · Exact version
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_zlZ6AFLFzSPwI2mcinIBXQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Diagnose streaming that works locally but not when deployed <span>— Vectle</span></a>