jaggedsoft / node-binance-api

Node Binance API is an asynchronous node.js library for the Binance API designed to be easy to use.
MIT License
1.57k stars 767 forks source link

getaddrinfo EAI_AGAIN fapi.binance.com #837

Open dajneem23 opened 2 years ago

dajneem23 commented 2 years ago

getaddrinfo EAI_AGAIN fapi.binance.com some time my server got this server when use futuresPositionRisk someone can help me ?

dmzoneill commented 2 years ago

This is typically associated with DNS lookup failures. To avoid failure, try adding the host IP and FQDN in your hosts file. If it still continues to happen. then bring back more supporting evidence.

dajneem23 commented 2 years ago

This is typically associated with DNS lookup failures. To avoid failure, try adding the host IP and FQDN in your hosts file. If it still continues to happen. then bring back more supporting evidence.

sometimes it happens sometimes it doesn't it goes back to normal when i restart docker

dmzoneill commented 2 years ago

The 8 fallacies of distributed computing

The network is reliable;
Latency is zero;
Bandwidth is infinite;
The network is secure;
Topology doesn't change;
There is one administrator;
Transport cost is zero;
The network is homogeneous.

I would look at your DNS providers, look at the ones with lowest latency. And structure my DNS lookup order off this. this config should also be used with docker (example below)

[daoneill@fedora automation-analytics-backend]$ cat /etc/docker/daemon.json 
{
    "exec-opts": ["native.cgroupdriver=systemd"],
    "log-driver": "json-file",
    "log-opts": {
      "max-size": "100m"
    },
    "storage-driver": "overlay2",
    "data-root": "/home/daoneill/docker",
    "debug": true,
    "dns": ["10.11.5.19", "1.1.1.1", "8.8.8.8"],
    "experimental": false
}

You can pass a host/ip pair to a docker container using

--add-host=""      : Add a line to /etc/hosts (host:IP)

trying providing

--add-host="fapi.binance.com/99.86.125.20"
dajneem23 commented 2 years ago

The 8 fallacies of distributed computing

The network is reliable;
Latency is zero;
Bandwidth is infinite;
The network is secure;
Topology doesn't change;
There is one administrator;
Transport cost is zero;
The network is homogeneous.

I would look at your DNS providers, look at the ones with lowest latency. And structure my DNS lookup order off this. this config should also be used with docker (example below)

[daoneill@fedora automation-analytics-backend]$ cat /etc/docker/daemon.json 
{
    "exec-opts": ["native.cgroupdriver=systemd"],
    "log-driver": "json-file",
    "log-opts": {
      "max-size": "100m"
    },
    "storage-driver": "overlay2",
    "data-root": "/home/daoneill/docker",
    "debug": true,
    "dns": ["10.11.5.19", "1.1.1.1", "8.8.8.8"],
    "experimental": false
}

You can pass a host/ip pair to a docker container using

--add-host=""      : Add a line to /etc/hosts (host:IP)

trying providing

--add-host="fapi.binance.com/99.86.125.20"

I tried to follow your guide.I changed it a bit to match docker compose.it works fine for the time being thanks for your guide

dajneem23 commented 2 years ago

it not work till get error read ECONNRESET

mr-smit commented 1 year ago

catch the error with try {} catch(err){} then retry.. create a function for retry

dajneem23 commented 1 year ago

catch the error with try {} catch(err){} then retry.. create a function for retry

I tried but it not work my solution is find other stable server that almost fixed