Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatibility with Non-Node Environments Due to qs Package #1027

Closed
1 task done
Rajaniraiyn opened this issue Sep 1, 2024 · 6 comments
Closed
1 task done

Incompatibility with Non-Node Environments Due to qs Package #1027

Rajaniraiyn opened this issue Sep 1, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@Rajaniraiyn
Copy link

Rajaniraiyn commented Sep 1, 2024

Confirm this is a Node library issue and not an underlying OpenAI API issue

  • This is an issue with the Node library

Describe the bug

The recent release introduced a dependency on the qs package (#1023), which relies on Node.js’s built-in utils module. This makes the entire SDK unusable in non-Node.js environments, such as browsers.

Dependency Chain:

qsside-channelobject-inspect

The object-inspect package, a transitive dependency of qs, uses a Node.js built-in module (utils), causing builds to fail in non-Node environments.

To Reproduce

  1. Attempt to build the SDK using esbuild with the target platform set as browser.
  2. The build fails due to the use of the Node.js built-in module.
Screenshot 2024-09-01 at 6 34 38 PM

Code snippets

Minimal Reproduction

OS

macOS

Node version

Chromium v128.0.6613.85

Library version

openai v4.56.2

@Rajaniraiyn Rajaniraiyn added the bug Something isn't working label Sep 1, 2024
@RobertCraigie
Copy link
Collaborator

Thanks for the report, we're investigating solutions.

In the meantime would you be able to share a minimal reproduction?

@Rajaniraiyn
Copy link
Author

Thanks for looking into this. Below is the reproduction, npm run build should throw an error from [email protected]. you can try configuring tsup.config.ts for more build options

https://stackblitz.com/edit/node-eqjgac?file=package.json&view=editor

@RobertCraigie
Copy link
Collaborator

Thanks so much, that repro is very helpful. Still investigating solutions, will hopefully have an answer soon.

@Rajaniraiyn
Copy link
Author

Hey @RobertCraigie, just checking in—any updates on this? Let me know if there’s anything I can help with!

Thanks!

@RobertCraigie
Copy link
Collaborator

Will have an update out shortly! In the final testing stages.

@RobertCraigie
Copy link
Collaborator

@Rajaniraiyn this will be fixed in the next release! #1081

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants