Skip to content

Best way to flush LF in Next.js? #1055

Answered by marcklingen
gullerg asked this question in Support
Discussion options

You must be logged in to vote

How do you deploy your NextJS application? If you deploy serverless (eg AWS Lambda), there's no way around shutdownAsync as otherwise the function is terminated before all events are batched to the Langfuse API.

I've built a quick demo of Langfuse (blog post) some time ago which uses NextJS and streaming responses. Maybe these lines are helpful:
https://github.com/langfuse/langfuse-docs/blob/9581297f5abeda767abd2d769c9f7a034a51e95f/pages/api/qa-chatbot.ts#L192-L224

Replies: 1 comment 1 reply

Comment options

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

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