Proxy error getaddrinfo ENOTFOUND
-
Hi, I'm trying Dynamic proxy with @colyseus/proxy. Here logs when start proxy
3|colyseus | @colyseus/proxy listening at {"address":"::","family":"IPv6","port":8080} 3|colyseus | LISTEN add { processId: 'sVP_lHbH6', address: 'null:2577' } 3|colyseus | LISTEN add { processId: 'LTUuaSyW6', address: 'null:2567' } 3|colyseus | LISTEN add { processId: 'cixG2EmEF', address: 'null:2587' }
Then, try to call an api and get error logs
3|colyseus-proxy | Using proxy 0 /ping 3|colyseus-proxy | Proxy error during: /ping 3|colyseus-proxy | Error: getaddrinfo ENOTFOUND null 3|colyseus-proxy | at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:66:26)
Please help, thanks
-
Hi @nguyen991, it seems the
internal-ip
is not being able to retrieve the IP address for your server. Here's the reference to the source-code where thisnull
is coming from: https://github.com/colyseus/colyseus/blob/530f13745e655c526f5b5aef9fa5cc05de5396d6/src/discovery/index.ts#L13@scarybanana (member on Discord) is having the same issue inside Kubernetes. I can't tell exactly why this is happening, I'd appreciate if you can help to inspect this issue
Cheers
-
Hello, each colyseus server will try to get it's ip address from process.env.SELF_HOSTNAME before falling back to internal-ip.
In some rare cases it appears internal-ip isn't working, so an easy fix is to set the SELF_HOSTNAME env variable for each server.