4.40.0 -> 4.40.1: Breaking change - OpenAI is not a constructor
Problem
Confirm this is a Node library issue and not an underlying OpenAI API issue - [x] This is an issue with the Node library Describe the bug Based on numbers, 4.40.1 is supposed to be a bug fix release over 4.40.0, so I didn't expect something to break. I have not tested the application after 4.40.1 to see if anything else is broken. const openai = new OpenAI({ ^ TypeError: OpenAI is not a constructor To Reproduce Code saved as test.js: [code block] [code block] Code snippets _No response_ OS WSL Ubuntu 24.04 LTS Node version v20.12.2 Library version 4.40.1
Error Output
Error: OpenAI is not a constructor
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Solution: 4.40.0 -> 4.40.1: Breaking change - OpenAI is not a constructor
At New Relic we instrument this package and this behavior is causing issues. I want to echo from what @YasharF has said that this was released in a patch and is a breaking change. This works fine when doing [code block] so maybe the exports in package.json need updated as well to handle CJS?
Trust Score
1 verification
- 1
At New Relic we instrument this package and this behavior is causing issues. I
At New Relic we instrument this package and this behavior is causing issues. I want to echo from what @YasharF has said that this was released in a patch and is a breaking change. This works fine when doing
- 2
so maybe the exports in package.json need updated as well to handle CJS?
so maybe the exports in package.json need updated as well to handle CJS?
Validation
Resolved in openai/openai-node GitHub issue #816. Community reactions: 0 upvotes.
Verification Summary
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep