-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"logger not initialized" when using tsx and CommonJS #147
Comments
Hi @nbsp, I am having problem even when the
|
we're currently working on making agents-js into a dual package, which would allow you to integrate Agents directly with CJS code natively |
@tanys123 if you encounter this error in an ESM exclusive environment (with type: module set), could you post the stack trace of the error? |
|
is this still run using tsx, or directly with Node? |
Directly with Node |
My node.js multimodal realtime chat app works fine in dev, but I get this same error in production after I pushed it to AWS Elastic Container Service (ECS). For some reason, the app works fine locally when I run both
I looked into the node_modules and saw that this error is in The
I noticed a few of the I'm fairly disappointed. I wanted to share this with a few early customers today. If there's a quick workaround, please let me know! |
The issue is that the logger uses module level state as a kind-of singleton pattern. As the agent plugins are published as separate packages, the logger state crosses package boundaries which can easily break down if there's anything causing the individual packages to use your own copy of @creightontaylor if you're in that boat you could try setting
|
the issue directly with Node has been fixed in #170 by using |
@nbsp I upgraded the packages:
And it now works in production! It's alive. It's ALIIIIIIVE! 😄 😄 😄 |
we are aware of a bug affecting users of the tsx runner with Agents.
specifically, it affects those who define their agent in files read as CommonJS.
if you don't use tsx/CJS and are running into this issue:
^0.4.5
(^0.6.0
for OpenAI)the fix
set
"type": "module"
in your package.json, or rename the file to explicitly use ESM (e.g.agent.ts
⇒agent.mts
).The text was updated successfully, but these errors were encountered: