openai / openai-node

The official Node.js / Typescript library for the OpenAI API
https://www.npmjs.com/package/openai
Apache License 2.0
7.88k stars 851 forks source link

Bun runtime error: Cannot find module "openai/_shims/auto/runtime" from "/app/.output/server/node_modules/openai/_shims/index.mjs" #1011

Open marcelxpfeifer opened 2 months ago

marcelxpfeifer commented 2 months ago

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

Describe the bug

When trying to run OpenAI in production with bun I get the following error Cannot find module "openai/_shims/auto/runtime" from "/app/.output/server/node_modules/openai/_shims/index.mjs"

It can be reproduced with minimal setup using Nuxt.

To Reproduce

  1. Clone the repo Minimal Reproduction
  2. Run bun install
  3. Run bun build
  4. Run bun .output/server/index.mjs
  5. When opening localhost:3000/api/test the server should throw the error

Running with node works

Code snippets

No response

OS

macOS, Linux

Node version

Bun v1.1.26

Library version

openai v4.56.0

RobertCraigie commented 2 months ago

@marcelxpfeifer thanks for the report, if you haven't already could you also report this to bun?

marcelxpfeifer commented 2 months ago

@marcelxpfeifer thanks for the report, if you haven't already could you also report this to bun?

Yes the issue can be found here