Hi all,
I'm trying to fix following problem since five days.
When I'm doing a
or
there's this error coming back:
HTTP 5021: SOCKET ERROR: getaddrinfo ENOTFOUND _host_ _host_:80 Error: getaddrinfo ENOTFOUND _url_ _url_:80
at errnoException (dns.js:26:10)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:77:26)
Got error: getaddrinfo ENOTFOUND _host_ _host_:80
NET 5021: destroy undefined
NET 5021: destroy
NET 5021: close
NET 5021: close handle
NET 5021: destroy
NET 5021: already destroyed, fire error callbacks
NET 5021: emit close
HTTP 5021: CLIENT socket onClose
HTTP 5021: removeSocket _host_:80: destroyed: true
HTTP 5021: HTTP socket close
When doing a https request to google.com:
Got error: connect ENETUNREACH 2a00:1450:400a:806::1014:443 - Local (:::0)
I can definitely say it's NOT a DNS or a PROXY issue.
What I testet so far:
node.js sample code:
var http = require('http');
var options = {
host: '_host_',
port: 80,
path: '/'
};
http.get(options, function(res) {
console.log("Got response: " + res.statusCode);
res.on("data", function(chunk) {
console.log("BODY: " + chunk);
});
}).on('error', function(e) {
console.log("Got error: " + e.message);
});
Just to be clear, you're not _actually_ doing http.get("http://url/", cb);
but rather http.get("http://www.google.com/", cb);
or some other website that exists - right?
Also, if you could try previous versions of Node and see if they work for you it would be very appreciated.
Yes. _url_ and _host_ are just placeholders.
getaddrinfo
is by definition a DNS issue. Does dig host
or nslookup host
work? Does dns.lookup(host, console.log)
work? Can you post the domain?
dig
is not available for buildroot. nslookup
is working and gives me the ip address back. I tested lots of different domains (ex. www.hackaday.com)
and yes, dns.lookup(host, console.log)
works and the returned ip address is correct.
What does dns.lookup(host, {hints: dns.ADDRCONFIG|dns.V4MAPPED}, console.log)
print?
{ [Error: getaddrinfo ENOTFOUND host]
code: 'ENOTFOUND',
errno: 'ENOTFOUND',
syscall: 'getaddrinfo',
hostname: 'host' }
Am I right that it works with {hints:0}
? What happens with {hints:dns.ADDRCONFIG}
and {hints:dns.V4MAPPED}
?
'x.x.x.x' 4
'x.x.x.x' 4
{ [Error: getaddrinfo ENOTFOUND host]
code: 'ENOTFOUND',
errno: 'ENOTFOUND',
syscall: 'getaddrinfo',
hostname: 'host' }
x.x.x.x is the correct IP returned.
Thanks. You didn't mention what version of glibc you have installed but you're probably hitting a bug in that library. www.hackaday.com is a good example - it's a CNAME for hackaday.com and older glibc versions didn't handle AI_V4MAPPED for such records.
As a workaround, try http.get({ family: 4, ... }, cb)
, that tells node not to use AI_V4MAPPED. Use { family: 6 }
if you want an IPv6 connection.
I'm using uclibc 1.0.12. At the moment I'm compiling buildroot with standard glibc. Will tell you if something has changed.
Setting the family to 4 is working. 6 is giving me back the known errors.
So, current workaround will be this:
var options = {
host: '_host_',
family: 4,
port: 80,
path: '/'
};
http.get(options, cb);
I cannot compile buildroot with standard glibc. There are too many errors.
So for now, above workaround will be the best solution for me.
Glad it's working for you now. I'll close the issue.
FYI, this was caused by uClibc-ng not handling AI_V4MAPPED correctly and is now fixed:
http://cgit.uclibc-ng.org/cgi/cgit/uclibc-ng.git/commit/?id=3c1457161e5206c2d576ab25d350a139511c096d
Hi Peter,
I just saw your message regarding the uClibc "bug". Thanks a lot!!!!! Will
try to rebuild and test it tomorrow.
Regards and have a nice weekend,
Michael
2016-03-11 13:00 GMT+01:00 Peter Korsgaard [email protected]:
FYI, this was caused by uClibc-ng not handling AI_V4MAPPED correctly and
is now fixed:http://cgit.uclibc-ng.org/cgi/cgit/uclibc-ng.git/commit/?id=3c1457161e5206c2d576ab25d350a139511c096d
โ
Reply to this email directly or view it on GitHub
https://github.com/nodejs/node/issues/5436#issuecomment-195339568.
You're welcome. Notice that there hasn't been any new uclibc-ng releases with this fix and it hasn't been integrated into the Buildroot yet. I'll most likely do so this weekend.
I noticed it before and thought to include the current rev version. But
now, I will wait until your release the new official version. Thanks a lot
again. Greets from Liechtenstein.
2016-03-11 21:02 GMT+01:00 Peter Korsgaard [email protected]:
You're welcome. Notice that there hasn't been any new uclibc-ng releases
with this fix and it hasn't been integrated into the Buildroot yet. I'll
most likely do so this weekend.โ
Reply to this email directly or view it on GitHub
https://github.com/nodejs/node/issues/5436#issuecomment-195524202.
/cc @indutny - perhaps lib/dns.js should only set AI_V4MAPPED when family == 6?
I just downloaded the newest buildroot and compiled it. My issue is now
fixed. Again, thanks a lot!
uclibc version 1.0.13 has now fixed the http.get issue.
2016-03-11 21:02 GMT+01:00 Peter Korsgaard [email protected]:
You're welcome. Notice that there hasn't been any new uclibc-ng releases
with this fix and it hasn't been integrated into the Buildroot yet. I'll
most likely do so this weekend.โ
Reply to this email directly or view it on GitHub
https://github.com/nodejs/node/issues/5436#issuecomment-195524202.
What versions of node was this fix included in?
workaround doesn't work for me. Node v6.5.0, MacOS 10.11.6
Error: getaddrinfo ENOTFOUND http://google.com http://google.com:80
at errnoException (dns.js:28:10)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:76:26)
You are doing a lookup for 'http://google.com/' when it should be just 'google.com'.
The same problem as@SoundBot, but is ok local, some time occur in docker.
originalError:
{ Error: getaddrinfo ENOTFOUND xxx.s3-ap-southeast-1.amazonaws.com xxx.s3-ap-southeast-1.amazonaws.com:443
at errnoException (dns.js:28:10)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:76:26)
message: 'getaddrinfo ENOTFOUND xxx.s3-ap-southeast-1.amazonaws.com xxx.s3-ap-southeast-1.amazonaws.com:443',
code: 'NetworkingError',
errno: 'ENOTFOUND',
syscall: 'getaddrinfo',
hostname: 'xxx.s3-ap-southeast-1.amazonaws.com',
host: 'xxx.s3-ap-southeast-1.amazonaws.com',
port: 443,
region: 'ap-southeast-1',
retryable: true,
time: 2016-11-18T04:29:58.603Z }
any body has work out the final resolution?
@denghuiquan did you try setting the 'family':4 option as suggested above? I had a similar problem and that fixed it for me. I'm surprised that problem is persisting even at the end of 2016. I was running into this issue on a RPI2 running Raspbian Lite using node v6.9.2.
specify an usable dns, normally the 8.8.8.8 for the dockerfile would help to this. @ArsalanDotMe
And I was getting
Error: getaddrinfo ENOTFOUND undefined undefined:80
NOT VERY HELPFUL AT ALL!11
UNDEFINED IS NOT FOUND, YEAH, SURE
MORE LIKE "UNDEFINED IS NOT A FUNCTION"
CAN'T ARGUE THAT!!!1
IS THAT A LINE NUMBER IN THE END OR WHAT?
HOW AM I SUPPOSED TO DEBUG THIS?
IS IT TOO HARD FOR YOUR DEVS TO INCLUDE A HUMAN-READABLE MEANINGFUL MESSAGE?
ARE YOU WRITING THIS FOR MACHINES? OR FOR HUMANS?
@halt-hammerzeit Please calm down, from https://github.com/nodejs/node/commit/b619831381a3a93e64e963b7bd95adc4df2eafe7 looks like this unfortunately unreadable error is there for backwards compatibility (in case you want to know why). Not sure if this is breakable at the moment.
@joyeecheung Nice userpic
Can someone explain, please, how to actually solve this issue now? Update node? Linux? Some package?
I'm on Ubuntu 16.04 LTS now. Still having the issue.
Thank you.
@Vasiliy-Bondarenko
This means your hostname
is undefined
.
Who would have guessed?
So cryptic and unprofessional from Node.js developers.
@catamphetamine, you bet! double undefined!
@catamphetamine it is always easy to blame someone. This will not help anyone though. If you like to improve the situation please open a pull request.
@BridgeAR it is always easy to blame a non-contributor for pointing out things that the supporting team fails to address and is ignorant of by saying he's not opening any pull requests.
As @joyeecheung mentioned about 10 months ago, changing this message will cause breakage in the community.
Current consensus seems to be that changing this will affect more users than it helps.
If you actually have any new information please do point it out, but being insulting is unlikely to achieve anything.
Can someone explain, please, how to actually solve this issue now? Update node? Linux? Some package?
I'm on Ubuntu 16.04 LTS now. Still having the issue.Thank you.
@Vasiliy-Bondarenko can you provide more information?
Which version of node are you using?
Can you post a sample code snippet?
You can also explicitly tell node's DNS to look for an IPv4 address with:
var options = {
host: XXXXXXXXXXXXX,
family: 4,
port: 80,
path: '/'
};
http.get(options, cb);
Current consensus seems to be that changing this will affect more users than it helps.
that will do
being insulting is unlikely to achieve anything.
it actually is, you're just not seeing the bigger picture
It will just make you get ignored, or, if you're too jerkass or meme-spammy, banned.
same error come
I'm seeing a similar issue and remarkably, was even able to reproduce it with nslookup on high sierra randomly.
$ nslookup x.x.net
Server: 10.x.x.x
Address: 10.x.x.x#53
** server can't find x.x.net: NXDOMAIN
$ nslookup x.x.net
Server: 10.x.x.x
Address: 10.x.x.x#53
Non-authoritative answer:
x.x.net canonical name = x.x.x.net.
Name: x.x.x.net
Address: 10.x.x.x
My Node ENOTFOUND is on v8.4.0 and happens intermittently while resolving bower package dependencies for a project, so I'm actually using request through the bower npm package. Is there a way to force request to use IPv4 globally at runtime? I'm guessing the glibc that ships with osx high sierra hasn't been patched yet?
Hello everyone.
I also get this error. Originally I was using node 8.9.3 and this problem was occurring spasmodically. I upgraded to 9.2.0 and still, on occasion the problem arises.
My process is a long running 'service' that does http POST
s to another nodejs service.
The http library I am using is: axios 0.16.2
And the error: getaddrinfo ENOTFOUND
Does anyone have a solution or workaround? I'm almost at the point where I need to do an external system call to curl..... not my preference as I'm sure you can imagine
Found this exact error because the host was not defined in the server configuration.
Was attempting a call on localhost, but localhost wasn't defined to link to 127.0.0.1
I get this Error Error: getaddrinfo ENOTFOUND api.remotehost.com api.remotehost.com:80
when I try to do this on google cloud functions
````
(req,res,next)=>{
let options={
method:'POST',
uri: config.uri,
form:{
username:req.body.username,
to:req.body.to,
message:req.body.message
},
headers:{ apikey:req.headers.apikey,
'Accept':"Application/json"
},
family: 4,
port: 80
}
request(options)
.then((_)=>res.status(200).send(_))
.catch((e)=>res.status(500).send(e))
}
````
It works fine on localhost ,I only get this on google cloud functions
I tried adding this { family: 6 }
as suggested above and I started getting this new error Error: getaddrinfo EAI_AGAIN api.remotehost.com:80
johnanisere,
I get the similar error with Cloud Functions. How did you resolve this?
I didn't solve it.I found out cloud functions only work with google
endpoints, you can't access third party endpoints via cloud functions.
On Wed, Mar 14, 2018 at 3:04 AM, Erick Franco notifications@github.com
wrote:
johnanisere,
I get the similar error with Cloud Functions. How did you resolve this?
โ
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/nodejs/node/issues/5436#issuecomment-372879992, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AYUraeHhpXDDrluU0Kr2YGkB8d6l4AXbks5teHrLgaJpZM4Hix3S
.
So, I did find out the problem. You'll need to enable billing at https://google.firebase.com for your project to make external API requests. If billing is not enabled you'll get an error.
Stated at the bottom of this article.
https://www.menubar.io/firebase-functions-sending-emails/
Just in case it might help someone. We had the same issue using 9.10.1 when our application was under heavy load, we resolved it by caching DNS values with https://github.com/devswede/dns-cache (we think it was related to https://github.com/nodejs/node-v0.x-archive/issues/7729).
Have also noticed this happening at random times in a CLI app which makes multiple calls to different APIs, will try out the DNS cache and see if that fixes it.
Is there a system (OS) level fix for this issue yet? I am running node v10
in docker and am unable to resolve certain hostnames due to this.
Need a way to fix this without touching application code (which the solutions above do)
Same problem here trying to request data from the Fritzbox router (fritz.box
) unsing node v8.11.2 About 30% of the requests will fail:
{ Error: getaddrinfo ENOTFOUND fritz.box fritz.box:49000
at errnoException (dns.js:50:10)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:92:26)
code: 'ENOTFOUND',
errno: 'ENOTFOUND',
syscall: 'getaddrinfo',
hostname: 'fritz.box',
host: 'fritz.box',
port: '49000' }
Any workaround for this? Started to get it locally randomly, I hard coded some ips but it is annoying
anyone pls help!
i am facing the same issue i am using firebase with react native expo app
any one tell me is it possible with firebase spark plane
FetchError: request to https://exp.host/--/api/v2/push/send failed, reason: getaddrinfo ENOTFOUND exp.host exp.host:443
Seeing the same issue in a long-running service. Restarting the service resolves it (temporarily).
I've faced the same issue. when too many request, the error will come out.
Why this issue closed.
node: v10
I have a Angular Protractor application. After end to end test done I need to write API call to azure and delete some record. I am also getting this error. Still no solution.
My api hosted in Azure need https connection to call.
Guys... as a workaround i've added a sleep function (1 millisecond) between the requests and, at least for now, the error is gone.
Sharing the function if anyone wants to try:
export function msleep (n) {
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, n)
}
Thank you so your respond. I am calling to this deleteRegistration method only one time? Why do I need to sleep this?
Please refer the screenshot.
Maybe we can retrieve the error description directly from the V8 engine like made in the this 22995 PR using the uvExceptionWithHostPort
function.
@bnoordhuis As far as I can understand adding family: 4
is just a workaround. So this is a bug in node? If so is this a bug on all platforms and all versions of node or is it solved in some version?
@croraf If you're referring to https://github.com/nodejs/node/issues/5436#issuecomment-189474356, that's a libc bug, not a Node.js bug.
@bnoordhuis So it is basically an OS issue?
I'm using centos where I have ldd --version ldd (GNU libc) 2.17
.
I see GNU libc 2.17 is from December 2012. https://en.wikipedia.org/wiki/GNU_C_Library#Version_history .
You think it is likely the error is present in 2.17?
(I see in 2.18 and 2.19 there are some patches for getaddrinfo: https://www.gnu.org/software/libc/)
@croraf Correct. I don't recall the exact version that contains the fix but at the time of writing glibc 2.23 was the latest and that version worked okay.
For me on macOS this was also a resolution problem based on the selected family. Does anybody know, which system library on macOS is used to carry out the resolution features? This library also seems to randomly switch between 4 and 6 resolutions. I believe, it isn't the glibc, right? ๐
@dploeger It's /usr/lib/libSystem.B.dylib
, which is macos's version of libc.
libSystem is actually a kind of container library, the actual DNS resolver is in /usr/lib/system/libsystem_info.dylib
, but that's probably more info than you needed. :-)
Thanks, @bnoordhuis. But coming to think about it, shouldn't system programs have the same problem of randomly doing 4 and 6 queries? Or do they just handle the outcome better than Node (or v8 actually) does?
I would expect, that if no family is given, Node should do both queries and return one that is successful - the default should still be 4 currently, I guess.
But alas, I'm not aware on which level this is actually carried out. ๐
Node.js is agnostic, it merely passes on the options to the system resolver. That means you get a lot of control but you also get to deal with libc idiosyncrasies.
Okay. And the other applications (like ping
) do the same but handle the result for you. Got it. Thanks.
same problem node expres js
i had the same problem when to node work behind proxy.
curl, wget, browse and postman works fine, but node request not.
works for me set proxy.host e proxy.port in axios config.
I face this issue while running angular protractor in azure pipeline. works fine in local machine but fails in pipeline . Is there any solution to this now ? If not any workarounds please?
I don't understand how the "fix" proposed by @bnoordhuis in 2016 is still relevant (or not a default option or documented) ๐
Easy - if Node.js were to list every random bug you could possibly hit in some third-party library, the documentation would be several times its current size.
Most helpful comment
And I was getting
NOT VERY HELPFUL AT ALL!11
UNDEFINED IS NOT FOUND, YEAH, SURE
MORE LIKE "UNDEFINED IS NOT A FUNCTION"
CAN'T ARGUE THAT!!!1
IS THAT A LINE NUMBER IN THE END OR WHAT?
HOW AM I SUPPOSED TO DEBUG THIS?
IS IT TOO HARD FOR YOUR DEVS TO INCLUDE A HUMAN-READABLE MEANINGFUL MESSAGE?
ARE YOU WRITING THIS FOR MACHINES? OR FOR HUMANS?