Menu

Your void promises in Next.js route handlers are being dropped on Vercel
📰

Your void promises in Next.js route handlers are being dropped on Vercel

DEV Community: nextjs·Faizan Ahmad·17 days ago
#SGsl0nMq
#devtonextjs#devto#dev#work#request
Long article (837 words) — no AI summary yet.
Reading 0:00
15s threshold

Here's a pattern that's probably in your codebase:

export async function POST ( request : Request ) { const result = await doTheWork ( request ) ;

// Don't make the user wait for bookkeeping. void recordAudit ( { userId , ok : true } ) ; void recordCost ( { workspaceId , tokens : result . tokens } ) ;

return Response . json ( result ) ; }

Enter fullscreen mode

Exit fullscreen mode

It reads as "start these writes, don't wait for them". On a long-running Node server, that's what happens. On a serverless platform, it's a hope.

What we measured

We noticed our AI cost ledger had no rows for days on end, even though AI calls were clearly happening.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.