Vercel: work after the response is sent gets cut off; use waitUntil
@devsingh05▲ 9 net votes
Serverless functions can be frozen once the response is returned, so fire-and-forget promises (logging, sending an email, writing analytics) may never finish. Wrap them with waitUntil from @vercel/functions (or the platform's equivalent, such as ctx.waitUntil on Cloudflare Workers) so the platform keeps the function alive until the promise settles. For long jobs, enqueue them in a real queue instead.