File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed
packages/node/src/integrations/tracing/openai Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -83,12 +83,19 @@ export class SentryOpenAiInstrumentation extends InstrumentationBase<Instrumenta
83
83
}
84
84
}
85
85
86
- const isESM = Object . prototype . toString . call ( exports ) === '[object Module]' ;
87
- if ( isESM ) {
86
+ // Constructor replacement - handle read-only properties
87
+ // The OpenAI property might have only a getter, so use defineProperty
88
+ try {
88
89
exports . OpenAI = WrappedOpenAI ;
89
- return exports ;
90
+ } catch ( error ) {
91
+ // If direct assignment fails, override the property descriptor
92
+ Object . defineProperty ( exports , 'OpenAI' , {
93
+ value : WrappedOpenAI ,
94
+ writable : true ,
95
+ configurable : true ,
96
+ enumerable : true ,
97
+ } ) ;
90
98
}
91
-
92
- return { ...exports , OpenAI : WrappedOpenAI } ;
99
+ return exports ;
93
100
}
94
101
}
You can’t perform that action at this time.
0 commit comments