Skip to content

AlreadyInitializedError: cannot re-initialize an initialized node #505

@aphelionz

Description

@aphelionz

Right now I'm trying to wire up https://github.com/orbitdb/orbit-db-test-utils with js-ipfs@^0.43.0 and [email protected]

Go IPFS is requiring the keys to be 2048 bits or larger, so I added the init configuration to the proc node like so:

module.exports = {
  defaults: {
    type: 'proc',
    test: true,
    disposable: true,
    ipfsModule: require('ipfs'),
    // These don't seem to have any effect
    // init: false,           
    // start: false,
    ipfsOptions: {
      init: {
        bits: 2048
      },
      config: {
        Addresses: {
          API: '/ip4/127.0.0.1/tcp/0',
          Swarm: ['/ip4/0.0.0.0/tcp/0'],
          Gateway: '/ip4/0.0.0.0/tcp/0'
        },
        Bootstrap: []
      }
    }
  },
  overrides: {
    go: {
      test: false,
      ipfsHttpModule: require('ipfs-http-client'),
      ipfsBin: require('go-ipfs-dep').path()
    }
  }
}

However, I get this error during the tests when trying to start a proc node:

  1) swarm workflow
       localSwarm (1): proc:
     AlreadyInitializedError: cannot re-initialize an initialized node
      at Proxy.init (node_modules/ipfs/src/core/components/init.js:340:31)
      at InProc.init (node_modules/ipfsd-ctl/src/ipfsd-in-proc.js:93:20)
      at async Factory.spawn (node_modules/ipfsd-ctl/src/factory.js:141:7)
      at async Promise.all (index 0)
      at async swarm (swarm.js:3:661)
      at async Context.<anonymous> (test/swarm.spec.js:34:21)

Further context:

  1. You can see all my latest code in this branch: refactor: update deps, add tests, make more lightweight orbitdb-archive/orbit-db-test-utils#11
  2. Code sandbox reproducing the error: https://codesandbox.io/s/error-reinitialize-c5c9n

cc @hugomrdias

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