Ride-The-Lightning / c-lightning-REST

REST APIs for Core Lightning written with node.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Server fails to start if IPV6 is disabled

saubyk opened this issue · comments

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
}
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 "::"
commented

fixed with b9e54bc