faileon
faileon11mo ago

JS SDK (Bundling)

Hey guys, just started tinkering with langfuse, loving the idea! I have a quick question, I am using LangchainJS on my node backend, and typescript is complaining about the CallbackHandler type
Type  CallbackHandler  is not assignable to type
BaseCallbackHandler | BaseCallbackHandlerMethodsClass
Type  CallbackHandler  is not assignable to type
BaseCallbackHandler | BaseCallbackHandlerMethodsClass
If i peek into the node_modules source code I see it extends the base class, so i dont really know why. any idea please? for now i can silent the error in multiple ways ofc, just wondering if someone else ran into this issue and have solution.
14 Replies
Marc
Marc11mo ago
HI @faileon, sorry for the inconvenience and thanks for reporting. We know that depending on the Langchain version, the integration leads to typing issues due to the current bundling. This will be resolved by this PR: https://github.com/langfuse/langfuse-js/pull/46
GitHub
Updated module exports for ESM by ksjogo · Pull Request #46 · langf...
Problem Changes Release info Sub-libraries affected Bump level Major Minor Patch Libraries affected All of them langfuse langfuse-node Changelog notes Added support for X
faileon
faileon11mo ago
Splendid, thanks for the quick reply, looking forward to the PR then 👍
Marc
Marc11mo ago
Can you share your package.json and tsconfig?
faileon
faileon11mo ago
sure, gotta do screenshots tho. discord wont let me upload large texts
No description
No description
Max
Max10mo ago
Hi all, we made major changes to the bundling of the SDK. It supports node versions >=16. The alpha version for this release is langfuse@2.0.0-alpha.1. I'd be happy to get some feedback whether this works for you
faileon
faileon10mo ago
Amazing thank you, I tried switching to "langfuse-langchain": "^2.0.0-alpha.1" and typescript is now happy and so am I because i dont have to cast it to any anymore :]
Marc
Marc10mo ago
Great! @faileon Will release it soon with docs as it has a breaking change (dropping support for certain es and Node versions)
faileon
faileon10mo ago
Is it node 20 and above only now?
Max
Max10mo ago
The new version supports >= Node16
jamesyu
jamesyu4mo ago
hey i know this is an ancient thread, but does the latest SDK work in Node 16? I'm getting a ReferenceError: Blob is not defined in langfuse-core/src/index.ts:486:26 which suggests it requires some 18 features. any quick workarounds?
Marc
Marc4mo ago
Did you try langfuse node?
Marc
Marc4mo ago
npm
langfuse-node
!GitHub Banner. Latest version: 3.11.2, last published: 16 days ago. Start using langfuse-node in your project by running npm i langfuse-node. There are no other projects in the npm registry using langfuse-node.
jamesyu
jamesyu4mo ago
ah looks like that worked, and traces are populated, but still getting that Blob is not defined error in the logs
Marc
Marc4mo ago
Would love to have a look together. Can we hop on a call for 5 minutes? https://cal.com/marc-kl/5