Giter Site home page Giter Site logo

Comments (17)

Ninn0x4F avatar Ninn0x4F commented on August 22, 2024

You should use npm start from the vault-ai directory and not in the secret dir

from vault-ai.

grivera82 avatar grivera82 commented on August 22, 2024

Sorry I entered the wrong screenshot. I doesn't work from the vault-ai directory too.

root@localhost:~/vault-ai# npm start

[email protected] start
bash -c 'source ./scripts/source-me.sh && ./scripts/go-compile.sh ./vault-web-server' && echo && ./bin/vault-web-server

=> Environment Variables Loaded
-> Installing './vault-web-server' dependencies
-> Compiling './vault-web-server'
... done

2023/04/19 16:32:53 [Config] Loaded ./config/ files
2023/04/19 16:32:53 MISSING OPENAI API KEY ENV VARIABLE
root@localhost:~/vault-ai#

from vault-ai.

Ninn0x4F avatar Ninn0x4F commented on August 22, 2024

It's okay no worries, can you please just do an "ls" in the secret directory to see if the naming is setup correctly? There should be 3 files named like this:

root@localhost ~/vault-ai/secret # ls -lahs
total 0
0 drwxr-xr-x 1 root root 4.0K Apr 18 16:03 .
0 drwxr-xr-x 1 root root 4.0K Apr 18 16:46 ..
0 -rw-r--r-- 1 root root 55 Apr 18 14:16 .gitignore
0 -rw-r--r-- 1 root root 52 Apr 18 14:16 openai_api_key
0 -rw-r--r-- 1 root root 56 Apr 18 16:03 pinecone_api_endpoint
0 -rw-r--r-- 1 root root 37 Apr 18 14:16 pinecone_api_key

The "openai_api_key" should also just include the API key and nothing else in the file but that error message indicates that the script cannot load the environment variable for the openAI API key.

from vault-ai.

grivera82 avatar grivera82 commented on August 22, 2024

root@localhost:/vault-ai# cd secret/
root@localhost:
/vault-ai/secret# ls -lahs
total 24K
4.0K drwxr-xr-x 2 root root 4.0K Apr 19 15:45 .
4.0K drwxr-xr-x 15 root root 4.0K Apr 19 16:17 ..
4.0K -rw-r--r-- 1 root root 55 Apr 19 15:38 .gitignore
4.0K -rw-r--r-- 1 root root 52 Apr 19 16:13 openai_api_key
4.0K -rw-r--r-- 1 root root 53 Apr 19 15:45 pinecone_api_endpoint
4.0K -rw-r--r-- 1 root root 37 Apr 19 15:44 pinecone_api_key
root@localhost:~/vault-ai/secret#

from vault-ai.

Ninn0x4F avatar Ninn0x4F commented on August 22, 2024

Thanks seem that this is also ok. I just noticed that it uses "bash -c" when it runs the source command that might be the issue here as it expands before the source is run. You could try to modify the "package.json" and delete the "source" at "start:" to get it running, however this will keep the keys in the environment loaded which might be an issue.

root@localhost ~/vault-ai # cat package.json
{
"name": "vault-web-server",
"private": true,
"version": "1.0.0",
"description": "vault core website",
"main": "index.js",
"scripts": {
"start": "./scripts/source-me.sh && ./scripts/go-compile.sh ./vault-web-server && echo && ./bin/vault-web-server",
"dev": "webpack --progress --watch",
"postinstall": "source ./scripts/source-me.sh && ./scripts/go-compile.sh ./vault-web-server"
},

This should work, had to use the same workaround in WSL.

Edit: Adding information about "bash -c" and sourcing envs https://unix.stackexchange.com/questions/135070/why-doesnt-source-work-when-i-call-bash-c

from vault-ai.

grivera82 avatar grivera82 commented on August 22, 2024

when I remove bash -c I get this

root@localhost:~/vault-ai# npm install

[email protected] postinstall
source ./scripts/source-me.sh && ./scripts/go-compile.sh ./vault-web-server

sh: 1: source: not found
npm ERR! code 127
npm ERR! path /root/vault-ai
npm ERR! command failed
npm ERR! command sh -c source ./scripts/source-me.sh && ./scripts/go-compile.sh ./vault-web-server

npm ERR! A complete log of this run can be found in: /root/.npm/_logs/2023-04-19T16_59_15_732Z-debug-0.log
root@localhost:~/vault-ai#

from vault-ai.

Ninn0x4F avatar Ninn0x4F commented on August 22, 2024

Yes because the "source" command is missing on your system / shell. If you remove the "source" in the package.json from the "start:" it will work.

from vault-ai.

grivera82 avatar grivera82 commented on August 22, 2024

Yes it worked and now I get a different error.

root@localhost:~/vault-ai# npm start

[email protected] start
./scripts/source-me.sh && ./scripts/go-compile.sh ./vault-web-server' && echo && ./bin/vault-web-server

sh: 1: Syntax error: Unterminated quoted string

from vault-ai.

Ninn0x4F avatar Ninn0x4F commented on August 22, 2024

Because now there is a single quote in behind ./vault-web-server' <---

Can you check if it might be in the package.json?
The start command should look like this one:

"start": "./scripts/source-me.sh && ./scripts/go-compile.sh ./vault-web-server && echo && ./bin/vault-web-server",

from vault-ai.

grivera82 avatar grivera82 commented on August 22, 2024

fixed the single quote and I get this

root@localhost:~/vault-ai# npm start

[email protected] start
./scripts/source-me.sh && ./scripts/go-compile.sh ./vault-web-server && echo && ./bin/vault-web-server

=> Environment Variables Loaded
-> Installing './vault-web-server' dependencies
-> Compiling './vault-web-server'
... done

2023/04/19 17:31:48 [Config] Loaded ./config/ files
2023/04/19 17:31:48 MISSING OPENAI API KEY ENV VARIABLE
root@localhost:~/vault-ai#

from vault-ai.

Ninn0x4F avatar Ninn0x4F commented on August 22, 2024

This is really strange, does it even load the API key into the environment?

If you just run:

echo $OPENAI_API_KEY

Does it print the API key at all or is it just empty after running "npm start"? Don't actually post the API key. If it's empty then it seem to fail loading it into the environment. If the API key is there then I might be out of ideas.

If you can also just test to run:

export OPENAI_API_KEY=ActualAPIKeyHere

Then it should set it and if you run the first command "echo $OPENAI_API_KEY" again it should show the API key. Then try to run "npm start" again.

from vault-ai.

grivera82 avatar grivera82 commented on August 22, 2024

It didn't print the API KEY.

The export command work and the server seems to be running but the website doesn't load.

root@localhost:~/vault-ai# npm start

[email protected] start
./scripts/source-me.sh && ./scripts/go-compile.sh ./vault-web-server && echo && ./bin/vault-web-server

=> Environment Variables Loaded
-> Installing './vault-web-server' dependencies
-> Compiling './vault-web-server'
... done

2023/04/19 18:53:18 [Config] Loaded ./config/ files
[negroni] listening on :8100
[negroni] Apr 19 18:53:27 | 200 | 1.000068ms
GET /
[negroni] Apr 19 18:53:42 | 200 | 970.527µs
GET /
[negroni] Apr 19 18:53:56 | 200 | 928.527µs
GET /
[negroni] Apr 19 18:54:00 | 200 | 751.913µs
GET /
[negroni] Apr 19 18:54:04 | 200 | 560.74µs
GET /

from vault-ai.

Ninn0x4F avatar Ninn0x4F commented on August 22, 2024

That's good news, regarding the website you also need to run the following command in a second shell to build the template: npm run dev

I forgot to run it at first too which results in a blank page. Afterwards you can just run "npm start" no need to run "npm run dev" again if there was no update to js code.

from vault-ai.

grivera82 avatar grivera82 commented on August 22, 2024

I did run it but still no website.

root@localhost:~/vault-ai# npm run dev

[email protected] dev
webpack --progress --watch

assets by chunk 169 KiB (id hint: vendors)
asset vendors-node_modules_react-dropzone_dist_es_index_js-node_modules_uuid_dist_esm-browser_v4_js.bundle.js 133 KiB [compared for emit] (id hint: vendors)
asset vendors-node_modules_react-router-dom_es_Link_js-node_modules_url-parse_index_js-node_modules-b6a711.bundle.js 35.9 KiB [compared for emit] (id hint: vendors)
asset bundle.js 1.18 MiB [compared for emit] (name: app)
asset components_Pages_LandingPage_index_jsx.bundle.js 105 KiB [compared for emit]
asset components_Header_index_jsx.bundle.js 24 KiB [compared for emit]
orphan modules 42 KiB [orphan] 27 modules
runtime modules 6.98 KiB 10 modules
modules by path ./node_modules/ 1.19 MiB 68 modules
modules by path ./components/ 93.9 KiB
modules by path ./components/.less 22.8 KiB 6 modules
modules by path ./components/Util/
.jsx 7.81 KiB 4 modules
modules by path ./components/Pages/LandingPage/ 20.7 KiB 3 modules
modules by path ./components/Header/ 8.88 KiB 3 modules
modules by path ./components/Page/ 6.87 KiB 3 modules
modules by path ./components/Footer/ 19.2 KiB 3 modules
modules by path ./components/*.jsx 5.14 KiB
./components/index.jsx 430 bytes [built] [code generated]
./components/routes.jsx 4.72 KiB [built] [code generated]
./components/Go/index.jsx 2.48 KiB [built] [code generated]
webpack 5.64.0 compiled successfully in 5815 ms

from vault-ai.

jonbell-lot23 avatar jonbell-lot23 commented on August 22, 2024

Hello @Ninn0x4F I was seeing the same issues earlier on a standard, up-to-date Mac environment. (zsh, not bash)

I tried a lot of things, including hard-coding the API keys into the script. Eventually I did get the website to load, but only once, then it went back to having this error. No idea what would have caused that.

But yeah, I'd recommend a more standard approach to using these keys. Can you just use a env variables in a single file? Looking forward to getting this working, thanks for the code!

from vault-ai.

trv893 avatar trv893 commented on August 22, 2024

edit sorry i meant running the command: source ./scripts/source-me.sh
before npm start and npm run dev, after making the below changes:

*ubuntu vm with bash added to package.json file
"scripts": {
"start": "bash -c 'source ./scripts/source-me.sh && ./scripts/go-compile.sh ./vault-web-server' && echo && ./bin/vault-web-server",
"dev": "webpack --progress --watch",
"postinstall": "bash -c 'source ./scripts/source-me.sh && ./scripts/go-compile.sh ./vault-web-server'"
},

i think it could be because thats getting ran in a different terminal that doesnt like source, but i could be wayyy off...
if anyone has more info on this i would love to hear it!

from vault-ai.

LeviHan999 avatar LeviHan999 commented on August 22, 2024

bash -c

I am having the same problem, I am working on a macbook, did you solved that problem, bro?

from vault-ai.

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.