openai-node
openai-node copied to clipboard
I'm loading a couple pieces like this in my frontend, mostly to use `.fromReadableStream`. It works when in dev mode (nextjs) but when I build I get an error about `Audio` already being declared in the app console. I'm not using anything with "audio" so I'm going to guess it's the way I'm loading them that's either causing it to load twice or there's something else going on.
I'm loading a couple pieces like this in my frontend, mostly to use .fromReadableStream. It works when in dev mode (nextjs) but when I build I get an error about Audio already being declared in the app console. I'm not using anything with "audio" so I'm going to guess it's the way I'm loading them that's either causing it to load twice or there's something else going on.
import { APIUserAbortError } from 'openai';
import { ChatCompletionStream } from 'openai/lib/ChatCompletionStream';
I'm loading the abort error to handle when the stream gets aborted.
Originally posted by @a2thek26 in https://github.com/openai/openai-node/discussions/182#discussioncomment-7742034
Thanks.
As a workaround, can you try importing the error class directly from the file it's declared in, or just checking error.name === 'APIUserAbortError'?
cc @kenjam97 who reported:
Also seeing this same error when I build (nextjs), no issues in dev mode at all, only in production
Could you try either workaround?