Tell us what’s happening:
I am getting an error express-session deprecated req.secret; provide secret option server.js:16:9
Listening on port 3000
MongoParseError: URI malformed, cannot be parsed https://freecodecam-boilerplate-xuhf289jwg6.ws-us118.gitpod.io/
Your code so far
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36
Challenge Information:
Advanced Node and Express - Set up Passport
Ignore any deprecation warnings.
-
Make sure you are using dotenv and are reading from the .env
file.
-
Make sure you added the required SESSION_SECRET
environment variable to the .env
file.
-
Check your DB connection string is formatted correctly, and again if it is in the .env
file make sure you are reading from it correctly.
We can’t see your code. Read the initial challenge description on how to share your Gitpod workspace to get help.
I have it in progress.env like
PORT=8080
NODE_ENV=development
MONGO_URI="mongodb+srv://romif:<password>@cluster0.k1h7bvo.mongodb.net/exercice_tracker-db?retryWrites=true&w=majority"
SESSION_SECRET=randommmm
Did you name the file progress.env
? If so, just use .env
as the file name.
If you log out the environment variables, do you see them?
The fact that both “provide secret option” and the “MongoParseError: URI malformed” messages are shown, would suggest you are not reading the values from the .env
file.
1 Like
renaming to .env fix the issue, thank you!