Skip to content

TypeError: Cannot read private member from an object whose class did not declare it at __classPrivateFieldGet #1590

@FaresKi

Description

@FaresKi

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 running my code in production, I got this very random error:

TypeError: Cannot read private member from an object whose class did not declare it at __classPrivateFieldGet 

(file:///app/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/openai/internal/tslib.mjs:14:15) at Proxy.buildURL
(/app/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/openai/src/client.ts:446:23) at Proxy.buildRequest 
(/app/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/openai/src/client.ts:818:22) at Proxy.makeRequest 
(/app/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/openai/src/client.ts:532:46) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async file:///app/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@opentelemetry+_6b14e933d3433c65dede7732832881c4/node_modules/@langchain/openai/dist/embeddings.js:182:29 at async RetryOperation._fn (/app/node_modules/.pnpm/[email protected]/node_modules/p-retry/index.js:50:12)

What's strange is that this error typically happens in a container with a Linux environment. In my case, Ubuntu.
I've tried to replicate it but I simply cannot.
Considering downgrading for now but I'm not sure if it's a "langchain/openai" issue, or an "openai" one.

To Reproduce

I'm not even sure, I'm sorry.
i'm creating the openai client via langchain:

new ChatOpenAI({
     apiKey: process.env.OPENAI_API_KEY,
     modelName: "gpt-4o",
})

Code snippets

OS

Ubuntu

Node version

v22.17.1

Library version

openai 5.10.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingsdk

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions