Are .env files broken at

This is not my first time posting here about an .env file that is not working properly. I’m doing the Implement the Serialization of a Passport User challenge in the Quality Assurance - Advanced Node and Express Cert.

I’m getting this error when running the server:

MongoParseError: URI malformed, cannot be parsed

I’ve followed the steps in this post with the same issue: MongoParseError: URI malformed, cannot be parsed and still the same.

I’m also getting this in the console:

express-session deprecated req.secret; provide secret option

Error: secret option required for sessions

This is my .env file, which as far as I know it is correct:


Link to the project: :arrow_upper_right:

(I had to delete the sample.env file that came with the boilerplate because Replit didn’t allow me to rename it to .env and add a new file named .env)

Hey, there. have been doing a lot of changes, recently. This could have affected the way .env files are used. However, it should still be possible to access the contents of a .env file via process.env, with the dotenv package.

So, provided you have followed the instructions, and have this at the top of your file:

'use strict';

I have not experienced any issues with .env in Repl.

I am not sure why you would need to do this. Typically, you can just copy the sample.env (it is not used by the system)

Hope you can get this sorted.

@Catalactics This is quite a different problem.

1 Like

Thank you very much again for your time. I will look into it, hopefully it has been fixed.