Skip to content

fix(node): Assign default export of openai to the instrumented fn #17320

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

Merged
merged 2 commits into from
Aug 5, 2025

Conversation

RulaKhaled
Copy link
Member

@RulaKhaled RulaKhaled commented Aug 5, 2025

Both of:

  • import OpenAI from openai
  • import { OpenAI } fromopenai

Should point to the instrumented wrapper function.

@RulaKhaled RulaKhaled changed the title fix(node): Assign default export of openai to the instrumented fn fix(node): Assign default export of openai to the instrumented fn Aug 5, 2025
Copy link
Contributor

github-actions bot commented Aug 5, 2025

size-limit report 📦

Path Size % Change Change
@sentry/browser 23.98 kB - -
@sentry/browser - with treeshaking flags 22.56 kB - -
@sentry/browser (incl. Tracing) 39.69 kB - -
@sentry/browser (incl. Tracing, Replay) 77.8 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 67.65 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 82.49 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 94.59 kB - -
@sentry/browser (incl. Feedback) 40.65 kB - -
@sentry/browser (incl. sendFeedback) 28.64 kB - -
@sentry/browser (incl. FeedbackAsync) 33.54 kB - -
@sentry/react 25.71 kB - -
@sentry/react (incl. Tracing) 41.62 kB - -
@sentry/vue 28.45 kB - -
@sentry/vue (incl. Tracing) 41.5 kB - -
@sentry/svelte 24.02 kB - -
CDN Bundle 25.49 kB - -
CDN Bundle (incl. Tracing) 39.57 kB - -
CDN Bundle (incl. Tracing, Replay) 75.62 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 81.06 kB - -
CDN Bundle - uncompressed 74.56 kB - -
CDN Bundle (incl. Tracing) - uncompressed 117.18 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 231.45 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 244.05 kB - -
@sentry/nextjs (client) 43.7 kB - -
@sentry/sveltekit (client) 40.14 kB - -
@sentry/node-core 47.72 kB -0.01% -1 B 🔽
@sentry/node 146.61 kB +0.02% +20 B 🔺
@sentry/node - without tracing 91.82 kB - -
@sentry/aws-serverless 103.27 kB - -

View base workflow run

Copy link
Member

@mydea mydea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we maybe also add a test covering this? (could also be in a follow up)

try {
exports.default = WrappedOpenAI;
} catch (error) {
Object.defineProperty(exports, 'default', {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we add a comment here explaining what we do here and why? When would this fail, and would the catch block work then? Can/should we just always do the catch block here?)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on it

@RulaKhaled RulaKhaled merged commit 873fc7b into develop Aug 5, 2025
183 checks passed
@RulaKhaled RulaKhaled deleted the assign-default-to-the-wrapped-fn branch August 5, 2025 11:38
andreiborza pushed a commit that referenced this pull request Aug 8, 2025
#17320)

Both of:
- import OpenAI from `openai`
- import { OpenAI } from`openai`

Should point to the instrumented wrapper function.
andreiborza added a commit that referenced this pull request Aug 8, 2025
Both of:
- import OpenAI from `openai`
- import { OpenAI } from`openai`

Should point to the instrumented wrapper function.

Backport of #17320.
andreiborza added a commit that referenced this pull request Aug 8, 2025
#17353)

Both of:
- import OpenAI from `openai`
- import { OpenAI } from`openai`

Should point to the instrumented wrapper function.

Backport of #17320.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants