Error: getaddrinfo EAI_AGAIN

2019-01-08 00:32发布

My server threw this today, which is a nodejs error I've never seen before.

Error: getaddrinfo EAI_AGAIN my-store.myshopify.com:443
    at Object.exports._errnoException (util.js:870:11)
    at errnoException (dns.js:32:15)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:78:26)

I'm wondering if this is related to the DynDns DDOS attack which affected Shopify and many other services today. Here's an article about that.

My main question is what does dns.js do? What part of node is it apart of? I can I recreate this error with a different domain?

5条回答
劳资没心,怎么记你
2楼-- · 2019-01-08 00:58

EAI_AGAIN is a DNS lookup timed out error, means it is a network connectivity error or proxy related error.

My main question is what does dns.js do?

  • The dns.js is there for node to get ip address of the domain(in brief).

Some more info: http://www.codingdefined.com/2015/06/nodejs-error-errno-eaiagain.html

查看更多
倾城 Initia
3楼-- · 2019-01-08 01:02

The OP's error specifies a host (my-store.myshopify.com). The error I encountered is the same in all respects except that no domain is specified.

My solution may help others who are drawn here by the title "Error: getaddrinfo EAI_AGAIN"

I encountered the error when trying to serve a NodeJs & VueJs app from a different VM from where the code was developed originally.

The file vue.config.js read :

 module.exports = {
   devServer: {
     host: 'tstvm01',
     port: 3030,
   },
 };

When served on the original machine the start up output is :

App running at:
- Local:   http://tstvm01:3030/ 
- Network: http://tstvm01:3030/

Using the same settings on a VM tstvm07 got me a very similar error to the one the OP describes:

 INFO  Starting development server...
 10% building modules 1/1 modules 0 activeevents.js:183                              
      throw er; // Unhandled 'error' event
      ^

Error: getaddrinfo EAI_AGAIN
    at Object._errnoException (util.js:1022:11)
    at errnoException (dns.js:55:15)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:92:26)

If it ain't already obvious, changing vue.config.js to read ...

 module.exports = {
   devServer: {
     host: 'tstvm07',
     port: 3030,
   },
 };

... solved the problem.

查看更多
倾城 Initia
4楼-- · 2019-01-08 01:03

@xerq pointed correctly, here's some more reference http://www.codingdefined.com/2015/06/nodejs-error-errno-eaiagain.html

i got the same error, i solved it by updating "hosts" file present under this location in windows os

C:\Windows\System32\drivers\etc

Hope it helps!!

查看更多
Viruses.
5楼-- · 2019-01-08 01:04

This is the issue related to hosts file setup. Add the following line to your hots file In Ububtu: /etc/hosts

127.0.0.1   localhost

In windows: c:\windows\System32\drivers\etc\hosts

127.0.0.1   localhost
查看更多
成全新的幸福
6楼-- · 2019-01-08 01:18

updating the npm to latest fixes this problem for me.

npm install npm@latest

this issue is related to your network connectivity. hence can be temporary. on a stable internet connection this issue was hardly observed.

查看更多
登录 后发表回答