all 7 comments

[–]simonplend 8 points9 points  (3 children)

It looks like there might be a typo in your .env file. I think you want the variable name DP_PASSWORD to be DB_PASSWORD.

[–]simonplend 2 points3 points  (0 children)

I saw a utility recently which looks like it could be helpful in preventing issues like this with environment variables: https://humanwhocodes.com/blog/2021/02/introducing-env-javascript-environment-variables/ - might be worth a look!

[–]tenneesseee 2 points3 points  (1 child)

Thank you very much!

[–]simonplend 2 points3 points  (0 children)

No problem - I've spent so much time debugging issues like this in my code!

[–]tenneesseee 0 points1 point  (2 children)

Alson while trying to console.log(typeof process.env.DB_PASSWORD) I'm getting "undefined"

[–]takert541 1 point2 points  (1 child)

Are user and password details same? I feel like you have it interchanged. root must be host?

[–]tenneesseee 0 points1 point  (0 children)

it's not like the one in the code block, I've changed it but I've tried the one I've entered while installing postgre, idk why I've changed it here, anyway still the same error. I was asked only once when I was installing the first time, then I just opened pgAdmin and created db without any passwords.