Next.js + MongoDB authentication problem

I’m integrating MongoDB into a Next.js application and I used the following command: ‘npx create-next-app --example with-mongodb mental-health-app’

I followed all the instructions to add a connection string. I am very sure that my connection string is correct: MONGODB_URI=“mongodb+srv://enguyen:###@cluster0.jxrki.mongodb.net/mental-health-app?retryWrites=true&w=majority&appName=Cluster0”

  1. I updated the password for the database user and ensured it matched in the connection string
  2. I created a new user, ensured the passwords and username matched, but it’s still not working!
  3. I even removed the database name, added it back in, removed the double-quotes and added it back in to no avail

Any ideas how I can fix this issue??

Hey :wave: @Evelyn_Nguyen,

Welcome to the MongoDB Community forums :sparkles:

Could you share the code snippet where you are reading the connection string from the .env file and the error message you are getting? It will help the community assist you better.

Looking forward to your response.

Regards,
Kushagra