File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
packages/node/src/integrations/tracing/openai Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -96,6 +96,23 @@ export class SentryOpenAiInstrumentation extends InstrumentationBase<Instrumenta
96
96
enumerable : true ,
97
97
} ) ;
98
98
}
99
+
100
+ // Wrap the default export if it points to the original constructor
101
+ // Constructor replacement - handle read-only properties
102
+ // The OpenAI property might have only a getter, so use defineProperty
103
+ if ( exports . default === Original ) {
104
+ try {
105
+ exports . default = WrappedOpenAI ;
106
+ } catch ( error ) {
107
+ // If direct assignment fails, override the property descriptor
108
+ Object . defineProperty ( exports , 'default' , {
109
+ value : WrappedOpenAI ,
110
+ writable : true ,
111
+ configurable : true ,
112
+ enumerable : true ,
113
+ } ) ;
114
+ }
115
+ }
99
116
return exports ;
100
117
}
101
118
}
You can’t perform that action at this time.
0 commit comments