-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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/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
, notimport
. Also, it seems important thattsx
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 ofchat.completions.create
.
rakyi
Metadata
Metadata
Assignees
Type
Projects
Status
No status