Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

version 0.0.20 broken #125

Open
AndrewMarchukov opened this issue Dec 7, 2023 · 8 comments
Open

version 0.0.20 broken #125

AndrewMarchukov opened this issue Dec 7, 2023 · 8 comments

Comments

@AndrewMarchukov
Copy link

When i trying just start mongo-gui i get this:

/opt/mongo-gui/lib/node_modules/mongo-gui/node_modules/openai/index.js:50
    constructor({ apiKey = Core.readEnv('OPENAI_API_KEY'), organization = Core.readEnv('OPENAI_ORG_ID') ?? null, ...opts } = {}) {
                                                                                                         ^

SyntaxError: Unexpected token '?'
    at wrapSafe (internal/modules/cjs/loader.js:915:16)
    at Module._compile (internal/modules/cjs/loader.js:963:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/opt/mongo-gui/lib/node_modules/mongo-gui/src/services/openai.js:1:16)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
@tesorogaming
Copy link

Setting Up the OpenAI Prompt Query
To enable the OpenAI-powered prompt querying in Mongo GUI, you'll need to obtain an API key from OpenAI and add it to your project. Here's a step-by-step guide:

Obtain an OpenAI API Key:

Visit OpenAI's platform
Sign up or log in, and navigate to the API section to generate your unique API key.
Add the API Key to Your Project:

In the root directory of your project, look for a .env file (or create one if it doesn't exist).
Add the following line to the .env file:
OPENAI_API_KEY=YOUR_API_KEY_HERE
Replace YOUR_API_KEY_HERE with the API key you obtained from OpenAI.
Save the .env file and restart Mongo GUI if it's currently running. With this, the AI-powered prompt querying should be activated!

🔐 Security Note: Remember to keep your .env file confidential. Never push it to public repositories or share it. It contains sensitive information.

@mariusrak
Copy link

But I don't want to use openai at all. This should be optional.

@arunbandari
Copy link
Owner

Thank you for bringing this to our attention. We will take a look at it.

@arunbandari
Copy link
Owner

@AndrewMarchukov which version of node.js you are using?

@ehsand
Copy link

ehsand commented Dec 31, 2023

i have same issue and i use node v18.19.0

/usr/lib/node_modules/mongo-gui/node_modules/openai/index.js:52
throw new Errors.OpenAIError("The OPENAI_API_KEY environment variable is missing or empty; either provide it, or instantiate the OpenAI client with an apiKey option, like new OpenAI({ apiKey: 'My API Key' }).");
^

OpenAIError: The OPENAI_API_KEY environment variable is missing or empty; either provide it, or instantiate the OpenAI client with an apiKey option, like new OpenAI({ apiKey: 'My API Key' }).
at new OpenAI (/usr/lib/node_modules/mongo-gui/node_modules/openai/index.js:52:19)
at Object. (/usr/lib/node_modules/mongo-gui/src/services/openai.js:3:16)
at Module._compile (node:internal/modules/cjs/loader:1356:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1414:10)
at Module.load (node:internal/modules/cjs/loader:1197:32)
at Module._load (node:internal/modules/cjs/loader:1013:12)
at Module.require (node:internal/modules/cjs/loader:1225:19)
at require (node:internal/modules/helpers:177:18)
at Object. (/usr/lib/node_modules/mongo-gui/src/controllers/document.js:3:16)
at Module._compile (node:internal/modules/cjs/loader:1356:14)

@awsms
Copy link

awsms commented Jun 13, 2024

Thank you for bringing this to our attention. We will take a look at it.

?

@kchojhu
Copy link

kchojhu commented Jun 20, 2024

Yeah, having OPENAI_API_KEY should be 'opt-in' feature and not enable by default. Easy way would be to enable OPENAI_API_KEY exists then enable it. Thanks for the library!

@mariusrak
Copy link

Is there any plan on fixing this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants