Comments (5)
I possibly found the problem
./node_modules/nextjs-openai/node_modules/openai-streams/dist/globs/node.js
This is in the nextjs-openai
module, not this one. However, there openai-streams
is installed within the nextjs-openai
module, and because I'm using nextjs-openai
on the client, this might be the reason it's throwing this error
from openai-streams.
Ah, yes. I stupidly re-exported the server-side only library at the client-side entry-point. Very true John, that is absolutely the problem, my bad. Let me try to fix it.
Thanks for being patient through these issues.
from openai-streams.
Hey, are you trying to use await OpenAI()
on the client?
This would leak your API key into the client bundle, this is an older version of the library freaking out and disallowing it.
If you're just using it in getServerSideProps()
or something, upgrading should get rid of this but if it didn't you could await import("...")
inside getServerSideProps()
to make sure it doesn't end up in the client.
from openai-streams.
It's only being imported in one place, and that's in the triniti
api route. Also, I double checked to make sure that route isn't being accidently called on a client page. We are using middleware, but I would hope that the middleware isn't getting exposed to the client, would be bad news for security
Also, I'm on latest (1.0.19)
from openai-streams.
So sorry for that again @Johnrobmiller. This should be fixed on latest. Docs should be up to date as well.
yarn add nextjs-openai openai-streams
# -or-
npm i --save nextjs-openai openai-streams
from openai-streams.
Related Issues (20)
- Great project! how's the Whisper API coming along? HOT 3
- Abort streams HOT 2
- Function TokenParser HOT 4
- lol HOT 1
- use error HOT 1
- Error [ERR_REQUIRE_ESM]: require() of ES Module HOT 2
- How to use in Node? HOT 3
- Some tokens are being dropped HOT 4
- Error: TypeError: fetch failed HOT 1
- A question about onDone callback HOT 4
- gpt4 access HOT 1
- Is it possible cancel a stream HOT 3
- Hi, you can use `publint` to check publish package errors HOT 3
- No named export 'OpenAI' from 'openai-streams/node' HOT 2
- Module build failed: UnhandledSchemeError: Reading from "node:fs" is not handled by plugins (Unhandled scheme). HOT 4
- Error [ERR_REQUIRE_ESM]: require() of ES Module HOT 1
- No fetch implementation found HOT 14
- This package fails with `node --loader tsx`
- Support for function calling HOT 1
- How to support `continue generating` response
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from openai-streams.