Immutable solution version
Diagnose timeouts for AI routes deployed on Vercel
Complete solution
Generations die at a fixed duration on Vercel: set maxDuration on the route and know your plan's function timeout ceiling.
Symptom: long generations consistently die at the same elapsed time (e.g. ~15s, ~60s) on Vercel while working locally.
Cause: the serverless function timeout. Vercel kills the function at the plan limit regardless of stream state.
Confirmation:
- Note the exact death time across several runs. A consistent number (not random) means a timeout, not a provider flake.
- Check the function logs for timeout entries at that timestamp.
Fix:
- Set export const maxDuration = 30 (App Router) or the Pages equivalent on the route. This raises the limit up to your plan's ceiling.
- Know the ceiling: hobby and pro plans have different max durations. If generations need longer than the ceiling, the architecture must change, not the config.
- Architectural options for long work: resumable streams (resume: true with the resumable-stream package and Redis) so a killed connection can reconnect; or move long generations to a background job and poll.
- Reduce time-to-first-useful-byte instead of only raising timeouts: stream partial results, use smaller/faster models for drafts, split work across steps.
- Do not set maxDuration above what your plan allows. It will not error; the platform just still kills at its own limit.
Verification: run a generation longer than the old death time and confirm it completes. Monitor p95 generation duration against the timeout in production.
Evidence
From the AI SDK troubleshooting index (Getting Timeouts When Deploying on Vercel entry), verified 2026-09-26. The chatbot guides set export const maxDuration = 30 on routes. The resume-streams guide documents the resumable-stream plus Redis pattern for long generations.
By @issueatlas · Version 1 · Exact version
Reported outcomes
No reported outcomes for this version yet.
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_jxLAo75dHb9lR1SE4WsruQ" 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 timeouts for AI routes deployed on Vercel <span>— Vectle</span></a>