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

Error: The libp2p node is not started yet #1631

Closed
m00nwtchr opened this issue Oct 13, 2018 · 1 comment
Closed

Error: The libp2p node is not started yet #1631

m00nwtchr opened this issue Oct 13, 2018 · 1 comment
Labels
exp/expert Having worked on the specific codebase is important kind/bug A bug in existing code (including security flaws) P2 Medium: Good to have, but can wait until someone steps up

Comments

@m00nwtchr
Copy link

m00nwtchr commented Oct 13, 2018

  • Version: { version: '0.32.3', repo: 7, commit: '' }
  • Platform: Linux lukas2005-local 4.18.9-200.fc28.x86_64 Add to cli: ipfs pin [-r] <ipfs-path> #1 SMP Thu Sep 20 02:43:23 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
  • Subsystem: Seems to be pubsub

Type: Bug

Severity: Medium

Description: Error: The libp2p node is not started yet

this seems to be similar to #874

Steps to reproduce the error:

While I don't know exactly what conditions are needed for this to happen it seems to be occurring in my unit tests continuously

My unit test file:

const assert = require("assert");
const os = require("os");
const path = require("path");
const fs = require("fs");
const rimraf = require("rimraf");

const {AnchorAPIBuilder} = require("anchor-api");
const IPFS = require("ipfs");

const ipfsOptions = {
    EXPERIMENTAL: {
        pubsub: true
    },
    repo: path.join(os.tmpdir(), ".jsipfs")
}

describe("AnchorAPI", () => {
    it("Creates an account", (done) => {
        rimraf.sync("./.orbitdb");
        let node = new IPFS(ipfsOptions);

        node.on('error', done);
        node.on('ready', async () => {
            new AnchorAPIBuilder()
            .setIPFS(node)
            .setLoginAndPassword("lukas2005", "p4ssw0rd")
            .createAccount()
            .then(async (anchor) => {

                await anchor.close();
                await node.stop();
                //rimraf.sync("./orbitdb/"+anchor.orbitdb.key.getPublic("hex"));
                    
                //if (fs.existsSync(ipfsOptions.path)) rimraf.sync(ipfsOptions.path);

                done();
            });
        });
    });

    it("Logs into a account", (done) => {
        //rimraf.sync("./orbitdb/");
        let node = new IPFS(ipfsOptions);

        node.on('error', done);
        node.on('ready', async () => {
            new AnchorAPIBuilder()
            .setIPFS(node)
            .setLoginAndPassword("lukas2005", "p4ssw0rd")
            .login()
            .then(async (anchor) => {

                await anchor.close();
                await node.stop();
                //rimraf.sync("./orbitdb");
                    
                //if (fs.existsSync(ipfsOptions.path)) rimraf.sync(ipfsOptions.path);

                done();
                process.exit(0);
            });
        });
    });

})

Full error:

(node:29160) UnhandledPromiseRejectionWarning: Error: The libp2p node is not startedyet
    at setImmediate (/home/lukas2005/Dokumenty/Projects/Anchor/API/node_modules/libp2p/src/pubsub.js:21:44)
    at Immediate._onImmediate (/home/lukas2005/Dokumenty/Projects/Anchor/API/node_modules/async/internal/setImmediate.js:27:16)
    at runCallback (timers.js:810:20)
    at tryOnImmediate (timers.js:768:5)
    at processImmediate [as _immediateCallback] (timers.js:745:5)
(node:29160) 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(). (rejection id: 1)
(node:29160) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.jsprocess with a non-zero exit code.
@alanshaw alanshaw added kind/bug A bug in existing code (including security flaws) exp/expert Having worked on the specific codebase is important status/ready Ready to be worked P2 Medium: Good to have, but can wait until someone steps up labels Oct 16, 2018
@m00nwtchr
Copy link
Author

m00nwtchr commented Oct 21, 2018

UPDATE! :)
Turns out the error happens after I stop the IPFS node
i just don't know what still calls pubsub.subscribe after that because I don't use pubsub directly and I have it enabled only for the orbit-db library

@ghost ghost removed the status/ready Ready to be worked label Oct 21, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
exp/expert Having worked on the specific codebase is important kind/bug A bug in existing code (including security flaws) P2 Medium: Good to have, but can wait until someone steps up
Projects
None yet
Development

No branches or pull requests

2 participants