Skip to content

OpenAI integration is breaking openai calls, even when the integration isn't enabled #17159

Closed

Description

@marcelgerber

Is there an existing issue for this?

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

  1. Go to the Codesandbox
  2. Run pnpm install, if deps are not already installed
  3. 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/node version 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 openai package 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, not import. Also, it seems important that tsx is 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.parse endpoint, instead of chat.completions.create.

Activity

  1. moved this to Waiting for: Product Owner in GitHub Issues with 👀 3on Jul 24, 2025
  2. marcelgerber commented on Jul 24, 2025

    @marcelgerber
    Author

    cc @RulaKhaled because you worked on the OpenAI integration (#17022).

  3. UNLRN commented on Jul 24, 2025

    @UNLRN

    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.create were working fine, but the images.generate were 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.

  4. RulaKhaled commented on Jul 24, 2025

    @RulaKhaled
    Collaborator

    Hello, thank you for raising this, i'm looking into it.

  5. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 3on Jul 24, 2025
  6. changed the title [-]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[/+] on Jul 24, 2025
  7. RulaKhaled commented on Jul 24, 2025

    @RulaKhaled
    Collaborator

    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

  8. self-assigned this
    on Jul 24, 2025
  9. RulaKhaled commented on Jul 25, 2025

    @RulaKhaled
    Collaborator

    This is fixed with the new 9.42.0 release.

  10. github-actions commented on Jul 31, 2025

    @github-actions
    Contributor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions