Cannot connect to MongoDB atlas when following the Next.js MongoDB tutorial

Hi Aasawari,

I found the issue. I hardcoded the uri in server/index.js file and I was successfully connected. When I tried to debug the issue, I noticed that my password was not retrieved properly from .env.local file. The reason is that my password contains a special character “$” and this was not read properly. So I changed my password and it is now working.

Thank you for your help and assistance.

2 Likes