Server fails to start if IPV6 is disabled
saubyk opened this issue · comments
Suheb commented
Reported by @devastgh :
If IPV6 is disabled, it refuses to start like:
~/.lightning/plugin/c-lightning-REST$ node cl-rest.js
Reading config file
error: WARN: /home/lightning/.lightning/lightning-rpc is missing, using the bitcoin mainnet subdirectory at /home/lightning/.lightning/bitcoin instead.
warn: --- Starting the cl-rest server ---
node:events:491
throw er; // Unhandled 'error' event
^
Error: listen EAFNOSUPPORT: address family not supported :::3001
at Server.setupListenHandle [as _listen2] (node:net:1446:21)
at listenInCluster (node:net:1511:12)
at doListen (node:net:1660:7)
at processTicksAndRejections (node:internal/process/task_queues:84:21)
Emitted 'error' event on Server instance at:
at emitErrorNT (node:net:1490:8)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
code: 'EAFNOSUPPORT',
errno: -97,
syscall: 'listen',
address: '::',
port: 3001
}
Suheb commented
To address the issue:
- perform a check if IPV6 addresses are available on the device
- If no addresses found, change the default value of BIND param to "0.0.0.0"
- else, keep it as "::"