Skip to content
Discussion options

You must be logged in to vote

You can now!

import { waitUntil } from "@vercel/functions";

// within the api handler
// will continue running even after the response as been returned
waitUntil(new Promise(resolve => setTimeout(() => {
  console.log("hello world"), 500)
}));

// immediately return your response
return response
npm i @vercel/functions

https://vercel.com/changelog/waituntil-is-now-available-for-vercel-functions

I accidentally found this by reading through the langfuse docs 😆 https://langfuse.com/docs/sdk/typescript/guide#option-1-waiting-for-flushasync-but-returning-immediately

Replies: 10 comments 8 replies

Comment options

You must be logged in to vote
1 reply
@AlbertMarashi
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@alanhett
Comment options

@Christopher-Hayes
Comment options

Comment options

You must be logged in to vote
2 replies
@alanhett
Comment options

@Christopher-Hayes
Comment options

Comment options

You must be logged in to vote
2 replies
@moshest
Comment options

@agentpietrucha
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@rezabrizi
Comment options

Answer selected by dotlouis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet