Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: querySrv ENODATA _mongodb._tcp.blog-cluster-0hb5z.mongodb.net at QueryReqWrap.onresolve [as oncomplete] [closed]

It looks like I cannot connect to my free Mongo Atlas cluster anymore. Everything was working and I have data that was collected when I look at the MongoDB website so I have no idea why it stopped working and can no longer connect. My entire site won't load.

This is there error I was getting:

{ Error: querySrv ENODATA _mongodb._tcp.blog-cluster-0hb5z.mongodb.net
    at QueryReqWrap.onresolve [as oncomplete] (dns.js:197:19)
  errno: 'ENODATA',
  code: 'ENODATA',
  syscall: 'querySrv',                                                                  Blog/app.js:54:14
  hostname: '_mongodb._tcp.blog-cluster-0hb5z.mongodb.net' }
like image 795
NasyaAS Avatar asked Feb 01 '19 17:02

NasyaAS


3 Answers

For some reason the dns server did not return srv records, changing the dns server to one that returns those records fixed the problem. (I used https://use.opendns.com/ to fix the it)

like image 146
copperi Avatar answered Oct 06 '22 01:10

copperi


In some cases, this happens when your IP address is not whitelisted in the MongoDB Atlas cluster. This is why it works with your IP address at home where you originally signed up your account, but doesn't work at a coffee shop WIFI or elsewhere.

So make sure your current IP address is added into your MongoDB cluster.

like image 30
Plus Pingya Avatar answered Oct 06 '22 00:10

Plus Pingya


I had the same problem working in a Starbucks went home and it connected right away try a different wifi connection.

like image 28
williamvivas Avatar answered Oct 06 '22 01:10

williamvivas