Repository navigation
Closed
Description
Is there an existing issue for this?
- I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- I have reviewed the documentation https://docs.sentry.io/
- I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/node
SDK Version
9.41
Framework Version
No response
Link to Sentry event
No response
Reproduction Example/SDK Setup
https://codesandbox.io/p/devbox/hardcore-margulis-fsy833?file=%2Fpackage.json%3A13%2C23
import * as Sentry from "@sentry/node"
Sentry.init({
dsn: "https://public@dsn.ingest.sentry.io/1337",
tracesSampleRate: 0.1,
})
const OpenAI = require("openai").OpenAI;
const openai = new OpenAI({
apiKey: "fake-openai-api-key",
})
openai.chat.completions.parse({
messages: [{ role: "user", content: "Test" }],
model: "gpt-4o",
})Steps to Reproduce
- Go to the Codesandbox
- Run
pnpm install, if deps are not already installed - Run
pnpm tsx main.js
Expected Result
The OpenAI call should just work without issues.
Actual Result
Instead, we get a runtime error:
> pnpm tsx main.js
This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:
TypeError: Cannot read private member from an object whose class did not declare it
at Object.__classPrivateFieldGet (/project/workspace/node_modules/.pnpm/openai@5.10.2/node_modules/openai/internal/tslib.js:21:15)
at Proxy.buildURL (/project/workspace/node_modules/.pnpm/openai@5.10.2/node_modules/openai/src/client.ts:446:23)
at Proxy.buildRequest (/project/workspace/node_modules/.pnpm/openai@5.10.2/node_modules/openai/src/client.ts:818:22)
at Proxy.makeRequest (/project/workspace/node_modules/.pnpm/openai@5.10.2/node_modules/openai/src/client.ts:532:46)
Further context
@sentry/nodeversion 9.39 works fine, versions 9.40 and 9.41 are both broken- There is an issue open for this in the openai repo, because initially I and others believed this to be an issue with the
openaipackage itself: TypeError: Cannot read private member from an object whose class did not declare it at __classPrivateFieldGet openai/openai-node#1590 - Note that the OpenAI instrumentation isn't even enabled in the above repro example
- It seems important that the OpenAI package is imported using
require, notimport. Also, it seems important thattsxis involved in running the project. There are probably also other ways to run into this problem, but I couldn't find any in this small repro environment. - It also seems relevant that the code is using the
chat.completions.parseendpoint, instead ofchat.completions.create.
Reacted by Martin Račák
Metadata
Metadata
Assignees
Projects
- StatusShow more project fieldsNo status
Activity
linear commentedon Jul 24, 2025
JS-770 OpenAI integration is breaking openai calls under certain circumstances, even when the integration isn't enabled
marcelgerber commentedon Jul 24, 2025
cc @RulaKhaled because you worked on the OpenAI integration (#17022).
UNLRN commentedon Jul 24, 2025
Was also having this issue and just wanted to confirm that downgrading this package "fixed" the openai issue we were having.
Also adding context that for us, our
chat.completions.createwere working fine, but theimages.generatewere the calls that were getting this error. So it does seem to be specific to certain API calls.We also did not have this integration enabled AFAIK.
RulaKhaled commentedon Jul 24, 2025
Hello, thank you for raising this, i'm looking into it.
[-]OpenAI integration is breaking openai calls under certain circumstances, even when the integration isn't enabled[/-][+]OpenAI integration is breaking openai calls, even when the integration isn't enabled[/+]RulaKhaled commentedon Jul 24, 2025
Hi there! I’ve identified a fix — see this PR: #17163. I’ll keep you posted once it’s released. Thanks again for the heads-up
RulaKhaled commentedon Jul 25, 2025
This is fixed with the new
9.42.0release.github-actions commentedon Jul 31, 2025
A PR closing this issue has just been released 🚀
This issue was referenced by PR #17163, which was included in the 10.0.0 release.