I setup my ipfs node in Node environment just like the example js-ipfs/examples/browser-exchange-files at master 路 ipfs/js-ipfs 路 GitHub does.
const node = await IPFS.create({
repo: './ipfs_database/ipfs2',
config: {
Addresses: {
Swarm: [
'/dns4/wrtc-star1.par.dwebops.pub/tcp/443/wss/p2p-webrtc-star',
'/dns4/wrtc-star2.sjc.dwebops.pub/tcp/443/wss/p2p-webrtc-star',
'/ip4/127.0.0.1/tcp/13579/wss/p2p-webrtc-star'
]
},
// If you want to connect to the public bootstrap nodes, remove the next line
Bootstrap: []
}
})
Got error when I start it:
(node:13192) UnhandledPromiseRejectionWarning: Error: no valid addresses were provided for transports [TCP,WebSockets,Circuit]
at TransportManager.listen (/Users/charlesliu/thesis/DemoCode/swarm-test/node_modules/libp2p/src/transport-manager.js:209:23)
at Libp2p._onStarting (/Users/charlesliu/thesis/DemoCode/swarm-test/node_modules/libp2p/src/index.js:539:33)
at Libp2p.start (/Users/charlesliu/thesis/DemoCode/swarm-test/node_modules/libp2p/src/index.js:309:18)
at start (/Users/charlesliu/thesis/DemoCode/swarm-test/node_modules/ipfs-core/src/components/network.js:45:18)
at async Function.start (/Users/charlesliu/thesis/DemoCode/swarm-test/node_modules/ipfs-core/src/utils/service.js:55:26)
at async IPFS.start (/Users/charlesliu/thesis/DemoCode/swarm-test/node_modules/ipfs-core/src/components/start.js:20:33)
at async Object.create (/Users/charlesliu/thesis/DemoCode/swarm-test/node_modules/ipfs-core/src/components/index.js:232:7)
at async main (/Users/charlesliu/thesis/DemoCode/swarm-test/peer1.js:4:16)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:13192) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
Can鈥檛 I use the webrtc-address in Node environment? It鈥檚 weird cause it works well in js-ipfs/examples/browser-exchange-files at master 路 ipfs/js-ipfs 路 GitHub.
The package.json of my demo is very simple:
{
"name": "demo",
"version": "1.0.0",
"description": "demo",
"main": "index.js",
"scripts": {
"start": "node peer1.js"
},
"author": "Charles Liu",
"license": "MIT",
"dependencies": {
"ipfs": "^0.52.2"
}
}
the ipfs verison is ipfs@0.52.3
I also tried run in electron and got same error, so it seems only browser support specifying webrtc-star in swarm address?