Ask coding questions

← Back to all posts
padlock key not working as .env
nanasv

I understand that .env in replite has been deplicated, but i used the padlock key to create my secret. I now added it as follow to my project an it is still NOT working what i my doing wrong here:
process.env.secre_key

Basically the mongoDb i used display from the console without any problem but when I deploy it shows:

mongodb Error: the parameter to open uri()must be a string . Which I understand is the issue of .env cause i solve it IN glitch before with this same error message by installing dotenv file. Please how can I solve this problem here on replite, OR how can i add the environment key successfully, Thank you.

Voters
nanasv
Comments
hotnewtop
RoBlockHead

Note that the env variables are only set when you use the run button to start your repl

nanasv

@RoBlockHead
please can you elaborate more or better still how can i set the run button to read the env variable. Because i have already done this:

language = "nodejs"
run = "npm start"

NOTE that i clone my project from git, build on glitch IDE. Again should i add the string from .env file (padlock) instead, thank you