Skip to content

updateAnnounceAddrs packages/transport-websockets is empty #3344

@ZababurinSergei

Description

@ZababurinSergei

I'm currently trying to deploy a node to a hosting account. Everything works fine locally. On the hosting account:

  • ==> No open HTTP ports detected on 0.0.0.0, continuing to scan... *

I looked in the library and the updateAnnounceAddrs method is empty.

How can I solve the problem of the server not starting to listen on addresses?

  • Version:
    "dependencies": {
    "@chainsafe/libp2p-gossipsub": "^14.1.2",
    "@chainsafe/libp2p-noise": "^17.0.0",
    "@chainsafe/libp2p-yamux": "^8.0.1",
    "@libp2p/autonat-v2": "^2.0.7",
    "@libp2p/bootstrap": "^12.0.8",
    "@libp2p/circuit-relay-v2": "^4.1.0",
    "@libp2p/crypto": "^5.1.13",
    "@libp2p/dcutr": "^3.0.7",
    "@libp2p/floodsub": "^11.0.8",
    "@libp2p/http": "^2.0.1",
    "@libp2p/http-fetch": "^4.0.1",
    "@libp2p/http-ping": "^2.0.1",
    "@libp2p/http-server": "^2.0.1",
    "@libp2p/identify": "^4.0.7",
    "@libp2p/interface": "^3.1.0",
    "@libp2p/interface-transport": "^4.0.3",
    "@libp2p/kad-dht": "^16.1.0",
    "@libp2p/logger": "^6.2.0",
    "@libp2p/mdns": "^12.0.8",
    "@libp2p/peer-id": "^6.0.4",
    "@libp2p/peer-id-factory": "^4.2.4",
    "@libp2p/peer-store": "^12.0.7",
    "@libp2p/ping": "^3.0.7",
    "@libp2p/pubsub-peer-discovery": "^12.0.0",
    "@libp2p/tcp": "^11.0.7",
    "@libp2p/utils": "^7.0.7",
    "@libp2p/webrtc": "^6.0.8",
    "@libp2p/websockets": "^10.1.0",
    "@libp2p/webtransport": "^6.0.9",
    "@multiformats/multiaddr": "^13.0.1",
    "@multiformats/multiaddr-matcher": "^3.0.1",
    "@nodeutils/defaults-deep": "^1.1.0",
    "blockstore-core": "^6.1.1",
    "compression": "^1.8.1",
    "cors": "^2.8.5",
    "datastore-core": "^11.0.2",
    "datastore-idb": "^4.0.1",
    "dotenv": "^17.2.3",
    "express": "^5.1.0",
    "express-enqueue": "^1.0.0",
    "http-proxy": "^1.18.1",
    "libp2p": "^3.1.0",
    "peer-id": "^0.16.0",
    "protons-runtime": "^5.6.0",
    "uint8arrays": "^5.1.0"
    }

  • Platform:
    linux manjaro

  • Subsystem:
    WebSocket transport

Severity:

Critical - System crash, application panic.

https://render.com/ not deploy project with webSocket transport

const RENDER_EXTERNAL_HOSTNAME = process.env.RENDER_EXTERNAL_HOSTNAME ? process.env.RENDER_EXTERNAL_HOSTNAME: 'localhost'

const PORT = process.env.PORT
    ? process.env.PORT
    : 6853;

let app = express();

const addresses = process.env.PORT
    ? {
      listen: [
        `/ip4/0.0.0.0/tcp/${PORT}/wss`
      ],
      announce: [
        `/dns4/${process.env.RENDER_EXTERNAL_HOSTNAME}`,
        `/dns4/${process.env.RENDER_EXTERNAL_HOSTNAME}/wss`
      ]
    }
    : {
      listen: [
        `/ip4/0.0.0.0/tcp/${PORT}/ws`
      ],
      announce: [
        `/dns4/localhost/tcp/${PORT}`,
        `/dns4/localhost/tcp/${PORT}/ws`
      ]
    }


const boot = [
  bootstrap({
    list: [
      '/dns4/relay-0.onrender.com/wss/p2p/12D3KooWBHSGgQQNinaUn9mtx7iqfQSM3sb1Fr1aCnkqLnyeT88i'
      // '/dns4/localhost/tcp/6835/ws/p2p/12D3KooWBHSGgQQNinaUn9mtx7iqfQSM3sb1Fr1aCnkqLnyeT88i'
    ]
  })
]


const libp2p = await createLibp2p({
  privateKey: peerId,
  addresses: addresses,
  transports: [
    tcp(),
    webSockets({
      httpRequestHandler: (req, res) => {
        const isLibp2p = handled(req, res)
        if (isLibp2p) {
          return
        }
        app(req, res)
      }
    })
  ],
  peerDiscovery: boot,
  connectionEncrypters: [noise()],
  streamMuxers: [yamux()],
  services: {
    identify: identify(),
    relay: circuitRelayServer(),
    ping: ping(),
    http: http(),
    pingHTTP: pingHTTP()
  }
})

libp2p.addEventListener('peer:discovery', (evt) => {
  console.log(`peer:discovery ${evt.detail.id.toString()}`)
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    need/triageNeeds initial labeling and prioritization

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions