Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Cannot create a node with an initialized repo #1245

Closed
@realharry

Description

@realharry
  • Version: 0.28.0
  • Platform: Ubuntu Desktop 17.10 (Linux 4.13.0-36-generic update roadmap #40-Ubuntu SMP Fri Feb 16 20:07:48 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux)
  • Subsystem: Node: 6.11.5

Type: Bug

Severity: Medium

Description:

Attempting to create an IPFS node using an initialized Repo object throws "Callback was already called." error.

Not sure if I'm using the API correctly (practically, it's my first day of using js-ipfs), but if I try to pass the repo argument with the initialized Repo object in the IPFS constructor, I get the following exception from Async:

/home/harry/ipfsjs/ipfs-repo/node_modules/async/internal/onlyOnce.js:9
        if (fn === null) throw new Error("Callback was already called.");
                     ^
Error: Callback was already called.
    at /home/harry/ipfsjs/ipfs-repo/node_modules/async/internal/onlyOnce.js:9:32
    at /home/harry/ipfsjs/ipfs-repo/node_modules/async/internal/parallel.js:36:13
    at /home/harry/ipfsjs/ipfs-repo/node_modules/write-file-atomic/index.js:142:7
    at FSReqWrap.oncomplete (fs.js:123:15)

Steps to reproduce the error:

Here' a sample code snippet:

const IPFS = require('ipfs');
const IPFSRepo = require('ipfs-repo');
const repo1 = new IPFSRepo('/tmp/ipfs-repo1');

repo1.init({}, (err) => {
    if (err) { console.log(err); return; }
    console.log('IPFS repo 1 initialized.');

    console.log('Creating IPFS node 1.');
    let node1 = new IPFS({
      repo: repo1,
      init: false,
      start: true,
      EXPERIMENTAL: {
      },
    });
    console.log('IPFS node 1 created.');
    node1.on('start', () => {
      console.log('IPFS node 1 started.');
    });
  })

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High: Likely tackled by core team if no one steps upexp/expertHaving worked on the specific codebase is importanthelp wantedSeeking public contribution on this issuekind/bugA bug in existing code (including security flaws)status/readyReady to be worked

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions