openai-node: openai@4.12 do not work on deno runtime?

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

I try to import openai on my netlify edge function, it works well days ago, but today it raises:

error: Uncaught (in promise) Error: Module not found "https://esm.sh/v133/openai@4.12.4/denonext/resources.js".
       const ret = new Error(getStringFromWasm0(arg0, arg1));
                  ^
       at __wbg_new_15d3966e9981a196 (file:///opt/buildhome/node-deps/node_modules/@netlify/edge-bundler/deno/vendor/deno.land/x/eszip@v0.40.0/eszip_wasm.generated.js:417:19)
       at <anonymous> (file:///opt/buildhome/node-deps/node_modules/@netlify/edge-bundler/deno/vendor/deno.land/x/eszip@v0.40.0/eszip_wasm_bg.wasm:1:93412)
            at <anonymous> (file:///opt/buildhome/node-deps/node_modules/@netlify/edge-bundler/deno/vendor/deno.land/x/eszip@v0.40.0/eszip_wasm_bg.wasm:1:1499594)
            at <anonymous> (file:///opt/buildhome/node-deps/node_modules/@netlify/edge-bundler/deno/vendor/deno.land/x/eszip@v0.40.0/eszip_wasm_bg.wasm:1:1938165)
            at __wbg_adapter_40 (file:///opt/buildhome/node-deps/node_modules/@netlify/edge-bundler/deno/vendor/deno.land/x/eszip@v0.40.0/eszip_wasm.generated.js:231:6)
       at real (file:///opt/buildhome/node-deps/node_modules/@netlify/edge-bundler/deno/vendor/deno.land/x/eszip@v0.40.0/eszip_wasm.generated.js:215:14)
       at eventLoopTick (ext:core/01_core.js:183:11)

Note that I found /denonext/resources.js missing from esm.sh. I don’t know if this is related.

To Reproduce

new a netlify edge function with just

import OpenAI from "https://esm.sh/openai"

and deploys it

Code snippets

No response

OS

Windows

Node version

deno

Library version

openai v4.12

About this issue

  • Original URL
  • State: closed
  • Created 8 months ago
  • Comments: 22

Most upvoted comments

Thank you for confirming!

We’ve now also published v4.16.1 which includes today’s api releases:

import OpenAI from 'https://deno.land/x/openai@v4.16.1/mod.ts';

Going forward, we’ll be publishing to demo.land/x/openapi, which is the recommended way to use this package from supabase and netlify edge functions.

We’ve released v4.15.3 to deno.land/x/, which you can use like so:

import OpenAI from 'https://deno.land/x/openai@v4.15.3/mod.ts';

We’re working to also publish 4.16.0, which contains the changes from DevDay’s announcements, shortly.

@joshling1919 can you open that as a separate issue, and share the code you’re using to make the request?

@rattrayalex My working import looks like this:

import OpenAI from 'https://esm.sh/openai@4.11'

Hey,

I’m using openai in Supabase Edge Functions and getting the above error. I tried importing from both npm:openai@4.13.0 and https://raw.githubusercontent.com/openai/openai-node/v4.12.4-deno/mod.ts

Screenshot 2023-10-25 at 3 11 20 PM Screenshot 2023-10-25 at 3 11 24 PM

deno CLI version 1.37.2

Thanks for the report, we’ll take a look.

On Sat, Oct 21 2023 at 1:35 AM, Muspi Merol @.***> wrote:

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

I try to import openai on my netlify edge function, it works well days ago, but today it raises:

error: Uncaught (in promise) Error: Module not found @./denonext/resources.js". const ret = new Error(getStringFromWasm0(arg0, arg1)); ^ at __wbg_new_15d3966e9981a196 @.@./eszip_wasm.generated.js:417:19) at <anonymous> @.@./eszip_wasm_bg.wasm:1:93412) at <anonymous> @.@./eszip_wasm_bg.wasm:1:1499594) at <anonymous> @.@./eszip_wasm_bg.wasm:1:1938165) at __wbg_adapter_40 @.@./eszip_wasm.generated.js:231:6) at real @.@.***/eszip_wasm.generated.js:215:14) at eventLoopTick (ext:core/01_core.js:183:11)

Note that I found /denonext/resources.js missing from esm.sh. I don’t know if this is related. To Reproduce

new a netlify edge function with just

import OpenAI from “https://esm.sh/openai

and deploys it Code snippets

No response OS

Windows Node version

deno Library version

openai v4.12

— Reply to this email directly, view it on GitHub https://github.com/openai/openai-node/issues/393, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFL6LQBL6VORHMSMULDYFDYANNILAVCNFSM6AAAAAA6J45C5KVHI2DSMVQWIX3LMV43ASLTON2WKOZRHE2TKMZTGQYDENQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>