Why do I get "getaddrinfo ENOTFOUND" error on hyperdev?


#1

Hi there,

I’ve been trying to write a sample code to get information from https://isitup.org. But on https request code, I’m getting this message:

Error: getaddrinfo ENOTFOUND https://isitup.org

In fact none of the websites seem to be reachable. Is it a restriction on hyperdev. Or am I doing something wrong in the code? Here’s what I’ve written:


var url_to_check = “https://isitup.org”;
var url_path = “/google.com.json”;

var options = {
host: url_to_check,
path: url_path,
method: ‘GET’,
};

var isitup_req = https.request(options, function(res){
//Other execution steps
};


#2

I get a 403 response unless you set the user-agent in the header, then it works: https://hyperdev.com/#!/join/6b525e6b-a040-4287-bdfc-2e06335dd2e2

It isn’t a HyperDev restriction, but a requirement of isitup by the looks of it.


#3

Hi Gareth,

Thank you for your help! I initially tried to add the user agent in the Options, but got an error saying I can’t do it. Then I added the user agent in the header and it seemed to be working. Another mistake that I did was to add https:// in the URL, when I removed it, the DNS error went away.

Thanks again for your help! :slight_smile:

-Vish