Skip to content

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

Merged
RulaKhaled merged 2 commits into
developfrom
assign-default-to-the-wrapped-fn
Aug 5, 2025
Merged

fix(node): Assign default export of openai to the instrumented fn#17320
RulaKhaled merged 2 commits into
developfrom
assign-default-to-the-wrapped-fn

Conversation

@RulaKhaled

@RulaKhaledRulaKhaled commented Aug 5, 2025

Copy link
Copy Markdown
Collaborator

Both of:

  • import OpenAI from openai
  • import { OpenAI } fromopenai

Should point to the instrumented wrapper function.

@RulaKhaledRulaKhaled changed the title fix(node): Assign default export of openai to the instrumented fnfix(node): Assign default export of openai to the instrumented fnAug 5, 2025
@github-actions

github-actionsBot commented Aug 5, 2025

Copy link
Copy Markdown
Contributor

size-limit report 📦

PathSize% ChangeChange
@sentry/browser23.98 kB--
@sentry/browser - with treeshaking flags22.56 kB--
@sentry/browser (incl. Tracing)39.69 kB--
@sentry/browser (incl. Tracing, Replay)77.8 kB--
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags67.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/react25.71 kB--
@sentry/react (incl. Tracing)41.62 kB--
@sentry/vue28.45 kB--
@sentry/vue (incl. Tracing)41.5 kB--
@sentry/svelte24.02 kB--
CDN Bundle25.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 - uncompressed74.56 kB--
CDN Bundle (incl. Tracing) - uncompressed117.18 kB--
CDN Bundle (incl. Tracing, Replay) - uncompressed231.45 kB--
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed244.05 kB--
@sentry/nextjs (client)43.7 kB--
@sentry/sveltekit (client)40.14 kB--
@sentry/node-core47.72 kB-0.01%-1 B 🔽
@sentry/node146.61 kB+0.02%+20 B 🔺
@sentry/node - without tracing91.82 kB--
@sentry/aws-serverless103.27 kB--

View base workflow run

@mydeamydea left a comment

Copy link
Copy Markdown
Member

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
Copy Markdown
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
Copy Markdown
CollaboratorAuthor

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 developAug 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 freeto 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

@RulaKhaled@mydea