When I run the debugger in vscode I get this error:
MongooseError: The `uri` parameter to `openUri()` must be a string, got "undefined". Make sure the first parameter to `mongoose.connect()` or `mongoose.createConnection()` is a string.
I realized this was because the debugger isn't getting access to my .env
file. My database uri is stored in my .env
file. So the debugger can't see it.
How can I give my debugger access to the my .env
file variables?
I fixed it by adding this to my
launch.json
file in my.vscode
workspace folder. I added two values to the configurations object: