- Symptom
- A promise fired without await after sending the response never completesEmails or database writes that run after res.json() are missing in production onlyWorks with a long running local server
- Cause
- Vercel only keeps an invocation alive for work it knows about. Promises that are not passed to waitUntil or Next.js after() can be cut off once the response is sent, and even tracked work shares the function max duration.
- Fix
- Wrap post response work in after() on Next.js 15.1 or later, or waitUntil from @vercel/functions elsewhere, and keep it within maxDuration. Use a queue or workflow for anything long.
- Apply
import { waitUntil } from '@vercel/functions'; export default { fetch(req: Request) { waitUntil(sendWelcomeEmail()); return new Response('ok'); }, };- Affected
- Vercel Functions on Node.js and Edge runtimes, all plans, as of October 2026
- Sources
Last verified 2026-10-15 · Confirmed by 0 builders