mongo-gui icon indicating copy to clipboard operation
mongo-gui copied to clipboard

version 0.0.20 broken

Open AndrewMarchukov opened this issue 1 year ago • 8 comments

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)

AndrewMarchukov avatar Dec 07 '23 23:12 AndrewMarchukov

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.

tesorogaming avatar Dec 13 '23 19:12 tesorogaming

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

mariusrak avatar Dec 18 '23 11:12 mariusrak

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

arunbandari avatar Dec 18 '23 15:12 arunbandari

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

arunbandari avatar Dec 29 '23 04:12 arunbandari

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)

ehsand avatar Dec 31 '23 08:12 ehsand