Error: querySrv ESERVFAIL _mongodb._tcp.cluster0.yalzkc2.mongodb.net

35 views Asked by At

I am tryping to deploey a MERN project on cpanel. Everything working fine on my localhost, but getting this error in my "stderr.log" log.

  1. I tried to restart the server again.
  2. Allowed access from anywhere on my atlas
1

There are 1 answers

1
Neeraj chaudhary On

hey i found the solution!! i solved the issue by edit my connection string ----> "mongodb+srv://username:[email protected]/" this as --------------> "mongodb://username:[email protected]:27017,ac-5jfoqgk-shard-00-01.yalzkc2.mongodb.net:27017,ac-5jfoqgk-shard-00-02.yalzkc2.mongodb.net:27017/?ssl=true&replicaSet=atlas-lfxg2j-shard-0&authSource=admin&retryWrites=true&w=majority"

You can do this by going to your atlas

  • step 1- sign in to your atlas account
  • step 2- click on "Database" under 'Deployment' section enter image description here
  • step 3- click on "Connect"
  • step-4- Click on drivers section enter image description here
  • step-5- change the version of the 'Nodejs' driver to '2.2.12 OR later'
  • step-6- Now copy the string

enter image description here

AND YOUR PROBLEM IS SOLVED