GithubHelp home page GithubHelp logo

Comments (5)

Johnrobmiller avatar Johnrobmiller commented on May 22, 2024 1

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.

ctjlewis avatar ctjlewis commented on May 22, 2024 1

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.

ctjlewis avatar ctjlewis commented on May 22, 2024

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.

Johnrobmiller avatar Johnrobmiller commented on May 22, 2024

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)

SS:
image

from openai-streams.

ctjlewis avatar ctjlewis commented on May 22, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.