I see one has to make sure that the DNS is resolved properly from the machine, check out the node documentation to make sure that domain
If all your code seems to be alright and you're still get the same error, which was my case, the solution was checking the nameservers on my /etc/resolv.conf
file.
I added Google's nameserver at the beginning of my resolv.conf
file (8.8.8.8) and the code started working just fine once again, no more error.
It's worth noticing that this error started happening on me on Feb. 4th 2015 after I ran an sudo apt-get upgrade
, my node js must have been updated and a bug introduced which seemed to be incompatible with the nameservers I had.
At first I checked if I was having any DNS issues by fetching the URL I needed using wget
on the command line, I got the contents of the target url fine so I didn't think it was actually a DNS issue, but it was.