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.…