Skip to content
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

TypeError: getDefaultAgent is not a function #903

Open
1 task done
guidev opened this issue Jun 19, 2024 · 2 comments
Open
1 task done

TypeError: getDefaultAgent is not a function #903

guidev opened this issue Jun 19, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@guidev
Copy link

guidev commented Jun 19, 2024

Confirm this is a Node library issue and not an underlying OpenAI API issue

  • This is an issue with the Node library

Describe the bug

When using openai-node with langchain and datadog, ESM, I get the following error:

TypeError: getDefaultAgent is not a function
    at OpenAI.buildRequest (file:https:///Users/name/Progetti/nonworking/node_modules/openai/core.mjs:208:66)
    at OpenAI.makeRequest (file:https:///Users/name/Progetti/nonworking/node_modules/openai/core.mjs:279:44)
    at async file:https:///Users/name/Progetti/nonworking/node_modules/@langchain/openai/dist/chat_models.js:796:29
    at async RetryOperation._fn (/Users/name/Progetti/nonworking/node_modules/p-retry/index.js:50:12)

Node.js v22.3.0


To Reproduce

1. git clone https://github.com/guidev/nonworking/tree/node20

2. npm run start 

Code snippets

No response

OS

macOS

Node version

node 20, node 22

Library version

4.52.0

@dgellow
Copy link

dgellow commented Jun 21, 2024

Hi @guidev,

Thanks for the bug report, and I appreciate the repo example to reproduce the issue. Looking into it.

@ericallam
Copy link

@dgellow this is an issue with import-in-the-middle, it somehow breaks the shims system. I've recreated the issue as a failing test in the import-in-the-middle repo here: nodejs/import-in-the-middle#113

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants