Closed christroutner closed 2 weeks ago
I'm getting same error but with much older versions:
{
"name": "@spaceai/ipfs",
"version": "1.0.0",
"description": "Space AI IPFS api",
"main": "server.js",
"scripts": {
"dev": "nodemon --trace-warnings server.js",
"start": "node server.js"
},
"author": "",
"license": "ISC",
"dependencies": {
"@chainsafe/libp2p-gossipsub": "^11.2.1",
"@libp2p/identify": "^1.0.15",
"@libp2p/mplex": "^10.0.16",
"@libp2p/peer-id": "^4.0.7",
"@libp2p/pnet": "^1.0.1",
"@orbitdb/core": "^2.0.1",
"blockstore-level": "^1.1.8",
"config": "^3.3.11",
"cookie-parser": "^1.4.6",
"dotenv": "^16.4.5",
"express": "^4.18.2",
"express-async-errors": "^3.1.1",
"helia": "^4.0.1",
"helmet": "^7.1.0",
"ipfs-http-client": "^60.0.1",
"joi": "^17.12.1",
"jsonwebtoken": "^9.0.2",
"libp2p": "^1.2.1",
"lodash": "^4.17.21",
"morgan": "^1.10.0",
"multiaddr": "^10.0.1",
"readline": "^1.3.0",
"secp256k1": "^3.6.2",
"uuid": "^9.0.1",
"winston": "^3.11.0"
},
"type": "module",
"git": {
"url": "git@chq:SpacesAI-com/SAI-IPFSAPI.git"
},
"devDependencies": {
"nodemon": "^3.0.3"
}
}
I just noticed this error trigger when discoveryRelays isn't 0.
You have unmet service dependencies.
If you want to listen on WebRTC addresses, you need to also listen on a relay. This is because the relay is used to perform the SDP handshake that initialises a WebRTC connection.
You can either configure a known relay to listen on directly, or you can set discoverRelays
to a positive integer which will attempt to find the specified number of relays via a content routing search and/or the identify protocol.
Either way, you need to configure the @libp2p/circuit-relay-v2
transport alongside the @libp2p/webrtc
transport if you wish to be dialable via WebRTC.
Thank you for the info @achingbrain. In certain configurations, I was not configuring the discoverRelays
option. That turned out the be the source of the issue.
Version:
Platform:
Subsystem:
Severity:
Description:
Steps to reproduce the error:
Trying to use the latest version of @libp2p/webrtc v4.1.7 resulted in this error when trying to create a libp2p node:
Could not start server. Error: CodeError: Service "@libp2p/webrtc" required capability "@libp2p/circuit-relay-v2-transport" but it was not provided by any component, you may need to add additional configuration when creating your node. at checkServiceDependencies (file:///home/trout/ipfs-service-provider/node_modules/libp2p/dist/src/components.js:100:23) at new Libp2pNode (file:///home/trout/ipfs-service-provider/node_modules/libp2p/dist/src/libp2p.js:160:9) at createLibp2pNode (file:///home/trout/ipfs-service-provider/node_modules/libp2p/dist/src/libp2p.js:337:12) at async IpfsAdapter.createLibp2p (file:///home/trout/ipfs-service-provider/node_modules/libp2p/dist/src/index.js:44:18) at async IpfsAdapter.createNode (file:///home/trout/ipfs-service-provider/src/adapters/ipfs/ipfs.js:199:22) at async IpfsAdapter.start (file:///home/trout/ipfs-service-provider/src/adapters/ipfs/ipfs.js:78:20) at async IPFS.start (file:///home/trout/ipfs-service-provider/src/adapters/ipfs/index.js:30:7) at async Adapters.start (file:///home/trout/ipfs-service-provider/src/adapters/index.js:61:11) at async Controllers.initAdapters (file:///home/trout/ipfs-service-provider/src/controllers/index.js:28:5) at async Server.startServer (file:///home/trout/ipfs-service-provider/bin/server.js:89:7) { code: 'ERR_UNMET_SERVICE_DEPENDENCIES', props: {} }
The library is looking for @libp2p/circuit-relay-v2-transport which does not exist on npm. Instead @libp2p/circuit-relay-v2 is the npm package that exists.
I traced the issue to this commit: https://github.com/libp2p/js-libp2p/commit/d1f1c2be78bd195f404e62627c2c9f545845e5f5
Rolling back to @libp2p/webrtc v4.0.34 fixed the problem.