Skip to content

Conversation

RulaKhaled
Copy link
Member

Backport of #17163

…ented fns (#17163)

The OpenAI SDK v5 uses ES private class fields (e.g. #baseURL), which
can only be accessed when methods are called with the correct this
context. In our instrumentation, methods that are not explicitly
instrumented (i.e. skipped by shouldInstrument) were returned unbound,
which broke calls to internal OpenAI methods like .parse() by
triggering:
TypeError: Cannot read private member from an object whose class did not
declare it.

This PR fixes that by explicitly binding all non-instrumented functions
to their original instance (value.bind(obj)), ensuring correct this
context and avoiding runtime errors when accessing private fields.

(cherry picked from commit 8b2c685)
@RulaKhaled RulaKhaled merged commit fa7a2b0 into v9 Jul 25, 2025
170 of 171 checks passed
@RulaKhaled RulaKhaled deleted the rola/fix-openai-err branch July 25, 2025 07:44
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