-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
SDK fails in ESM mode in combination with openai #12414
Comments
Hey @Xhale1 thanks for reporting! Just to rule something out: Which version of |
Same issue here, using openai: 4.47.3
|
Thanks for checking in! Just confirmed that my issue exists with version Let me know if a reproduction repo would help |
A reproduction would be greatly appreciated, thanks :) |
This is my first time making an issue reproduction repo, let me know if it works for you: https://github.com/Xhale1/sentry-openai |
Hmm yeah, I can reproduce this myself, thanks for the excellent repro app! I already tried switching the import style to namespace or named import but it doesn't matter. Looks like for some reason Update: Narrowed it down to the @timfish when you have a minute, would you mind taking a look? |
It looks like For |
I made a minimal reproduction here: It shows that all you have to do to make your app crash is |
I seem to remember it being caused by this issue which is a fundamental problem with |
v8.29.0 of the Node SDK adds the new import * as Sentry from '@sentry/node';
Sentry.init({
dsn: '__PUBLIC_DSN__',
registerEsmLoaderHooks: { onlyIncludeInstrumentedModules: true },
}); When set to This feature will only work if you Please let me know if this helps solve the |
@timfish, it seems that the option added in
For others: there's also relevant issue for the OpenAI package with some additional discussion: openai/openai-node#903. And a PR for |
Oh wow, thanks @torickjdavis, that means the release notes are wrong too. I'll correct these! |
Haha, I was a bit confused by the release notes too, thanks for the quick fix! (and thanks for your work here as always!) Off topic so feel free to disregard: how confident do you and the team feel in the Sentry + ESM stability now that this new option is released? Seems #12806 might be pretty much squared away? |
🚀 Awesome! I really should look, but haven't yet for Sentry's documentation process, but relevant documentation for |
This new option negates all of the fundamental (and not-fixable) issues we've found with There is a proposal for new loader hooks so this will likely continue to be a moving target.
We plan to add this to the documentation, we're just trying it out in apps ourselves and waiting for confirmation from more users that it is in fact solving the issues it was suppoed to. Sentry want it to be as simple and painless as possible to start using the SDKs so we are still left with things we want to improve here. This fix is currently opt-in which is far from ideal. It's not clear from the original error above that this new option will help here! |
I failed to update the description in my PR when we improved the property name after some discussion in the PR, so the wrong property name was used in the changelog: https://github.com/getsentry/sentry-javascript/blob/bcf571d9954094be76a99edbb12c23eff7f7b5dc/packages/node/src/types.ts#L20 Thanks to @torickjdavis for reporting this [here](#12414 (comment))!
Hello! I'm sorry for not closing the loop here earlier. Using the I'll leave this issue open on the oft chance @timfish wants to use it to track openai compatibility without this option, but feel free to close whenever you see fit :) Thank you everyone for your dedication to this issue and to the larger open source community :) |
How can i use |
@Ivan-juni you currently can't but we could provide that option via an env variable. I added this to our backlog: #14330 |
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
8.8.0
Framework Version
Node 20.14.0
Link to Sentry event
https://trainwell.sentry.io/issues/5463070600/?project=6067364&query=is%3Aunresolved+issue.priority%3A%5Bhigh%2C+medium%5D&referrer=issue-stream&statsPeriod=14d&stream_index=1
SDK Setup
Steps to Reproduce
openai
packageThe addition of the following code is what triggers the issue:
Expected Result
App builds with sentry instrumentation and no errors.
Actual Result
I receive the following error:
This might be related to #12237 however it appears to be a unique issue unrelated to initialization.
The text was updated successfully, but these errors were encountered: