-
Notifications
You must be signed in to change notification settings - Fork 863
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
Can not use OpenAI SDK with Sentry Node agent: TypeError: getDefaultAgent is not a function #1010
Comments
I definitely agree this is not a good situation. It is essentially a Sentry bug, and the workaround is documented in associated GitHub issue on their package:
which is confirmed by other users to fix the stacktrace reported here. For more background, both Sentry and Datadog make use of A more general workaround was documented in the other thread, but I believe it may need to be implemented at the library level, so I shared details in the associated Datadog issue as well. Note that I expect this problem to go away in the next major version of this library, when we switch from |
Actually, I'll keep this issue open until the next major version, as a reminder to double-check that it does indeed resolve this problem. |
Thanks for the quick response! And thanks for leaving this open, issue #903 was the first thing that popped up when googling so I think it'll be helpful for folks to see there's a resolution available from this library. Looking forward to the next version! |
Is there a way to resolve this problem? |
As per Alex's comment from the Sentry package, this resolved the problem for me; // Start Sentry
Sentry.init({
dsn: "https://my-dsn",
// add this to resolve bug
registerEsmLoaderHooks: {
exclude: [/openai/]
}
}); |
Confirm this is a Node library issue and not an underlying OpenAI API issue
Describe the bug
Referenced previously here, closed without resolution: #903
This is a pretty big issue as it prevents usage of the SDK while using the latest Sentry monitoring package.
To Reproduce
npm i @sentry/node --save
Results in error:
Code snippets
(Included)
OS
All operating systems (macOS, Linux)
Node version
v20.10.0
Library version
v4.56.0
The text was updated successfully, but these errors were encountered: