orbitdb: Node Error

I’m using a node to just ping back that the database has been replicated. It works, but eventually crashes with the following error.

/home/willemneal/Classes/SocialGood/orbit-db/node_modules/pull-pair/index.js:11
      throw new Error('already piped')
      ^

Error: already piped
    at sink (/home/willemneal/Classes/SocialGood/orbit-db/node_modules/pull-pair/index.js:11:13)
    at consume (/home/willemneal/Classes/SocialGood/orbit-db/node_modules/pull-defer/sink.js:7:17)
    at consume (/home/willemneal/Classes/SocialGood/orbit-db/node_modules/pull-defer/sink.js:7:17)
    at Connection.consume (/home/willemneal/Classes/SocialGood/orbit-db/node_modules/pull-defer/sink.js:7:17)
    at pull (/home/willemneal/Classes/SocialGood/orbit-db/node_modules/pull-stream/pull.js:43:9)
    at Dialer.handle (/home/willemneal/Classes/SocialGood/orbit-db/node_modules/multistream-select/src/dialer/index.js:47:5)
    at attemptMuxerUpgrade (/home/willemneal/Classes/SocialGood/orbit-db/node_modules/libp2p-switch/src/dial.js:157:10)
    at gotWarmedUpConn (/home/willemneal/Classes/SocialGood/orbit-db/node_modules/libp2p-switch/src/dial.js:54:7)
    at Switch.dial (/home/willemneal/Classes/SocialGood/orbit-db/node_modules/libp2p-switch/src/dial.js:40:9)
    at _getPeerInfo (/home/willemneal/Classes/SocialGood/orbit-db/node_modules/libp2p/src/index.js:237:19)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! orbit-db@0.19.7 examples:backup: `node examples/backup.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the orbit-db@0.19.7 examples:backup script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/willemneal/.npm/_logs/2018-04-04T19_19_54_145Z-debug.log

Here is the code used:

'use strict'
const IPFS = require('ipfs')
const OrbitDB = require('../src/OrbitDB')

// Create the first peer
const ipfs1 = new IPFS({ repo: './ipfs1' ,start: true,
EXPERIMENTAL: {
  pubsub: true,
},
Addresses: {
          Swarm: [
            "/ip4/0.0.0.0/tcp/4000"
          ],
          API: "/ip4/127.0.0.1/tcp/5005",
          Gateway: "/ip4/127.0.0.1/tcp/9999"
          }
  })
ipfs1.on('ready', async () => {
  // Create the database
  const orbitdb1 = new OrbitDB(ipfs1, './orbitdb1')
  const db1 = await orbitdb1.log('events',{write:['*']})
  console.log("done with first database "+ db1.address.toString())

    db1.events.on('replicated',async ()=> {
      db1.add("backed up on server")
    })

})

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 15 (2 by maintainers)

Most upvoted comments

From your stack trace you can see the error comes from libp2p-switch

Can you try npm list or yarn list if you use yarn and check which version of libp2p-switch is being pulled? According to its releases page, 0.40.2 contains the “Already piped” fix https://github.com/libp2p/js-libp2p-switch/releases/tag/v0.40.2