Replies: 2 comments
-
Hey there, @rovnyart! I'm here to help you with any bugs, questions, or contributions you have. Let's tackle this issue together! To enable sending custom traces in your Next.js app using Langfuse, you can follow these steps to troubleshoot and resolve the issue:
By following these steps, you should be able to resolve the issue and enable sending custom traces to Langfuse [1][2][3][4]. |
Beta Was this translation helpful? Give feedback.
-
@rovnyart Could you please try adding |
Beta Was this translation helpful? Give feedback.
-
We have a Next.js 14 app deployed to Vercel, which uses vercel AI SDK. We successfully added langfuse telemetry via instrumentation hook:
We are collecting telemetry to our Langfuse project with ai sdk
experimental_telemetry
, like this:Everything works fine, but now we need to make some "custom" traces, distributed among several services, and after doing some research we decided to try to do it via Langfuse, since it provides a way to use custom trace ids and not to share generated trace ids between services.
So we added "langfuse" package to our app, created a client (src/lib/langfuse.ts):
And then tried to created custom trace in one of our API endpoints (src/pages/api/webhook.ts) like this:
After deploying code to production we noticed that webhook endpoint fires, no traces are creating in Langfuse for some reason:( Triple-checked Vercel environment variables - everything is fine, all LANGFUSE_XXX env vars are valid. No error logs are creating, so I suppose langfuse.on('error') event don't fire too. We have no Idea why it this happening and how to enable sending custom traces in Next.js app - everything works in other services (deployed to Google Cloud App Engine and Google Cloud functions).
Does anyone have any ideas?
lib versions in Next.js project:
"ai": "3.4.32",
"langfuse": "3.28.0",
"langfuse-vercel": "3.28.0",
Beta Was this translation helpful? Give feedback.
All reactions