Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AlreadyInitializedError: cannot re-initialize an initialized node #505

Closed
aphelionz opened this issue Apr 29, 2020 · 3 comments
Closed

AlreadyInitializedError: cannot re-initialize an initialized node #505

aphelionz opened this issue Apr 29, 2020 · 3 comments
Labels
need/triage Needs initial labeling and prioritization

Comments

@aphelionz
Copy link

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

@aphelionz aphelionz added the need/triage Needs initial labeling and prioritization label Apr 29, 2020
@aphelionz
Copy link
Author

Looks like this is being addressed here: ipfs/js-ipfs#3013

@achingbrain
Copy link
Member

You may be able to get a bit further now that #504 has been merged & released as the key size isn't hard-coded any more so you can remove the init: { bits: 2048 }, bit of the config, which should stop the cannot re-initialize an initialized node (which should be resolved by ipfs/js-ipfs#2762 if I can find some time to get it into shape).

Anyway please try upgrading to [email protected]

@aphelionz
Copy link
Author

4.1.0 works! I am unblocked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need/triage Needs initial labeling and prioritization
Projects
None yet
Development

No branches or pull requests

2 participants