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

Promise rejection warning #75

Open
kuabhish opened this issue Feb 3, 2020 · 2 comments
Open

Promise rejection warning #75

kuabhish opened this issue Feb 3, 2020 · 2 comments

Comments

@kuabhish
Copy link

kuabhish commented Feb 3, 2020

UnhandledPromiseRejectionWarning: TypeError: this._libp2p.pubsub.getSubscribers is not a function at PubSubRoom._pollPeers (ipfs-pubsub-room\src\index.js:106:49) at listOnTimeout (internal/timers.js:531:17) at processTimers (internal/timers.js:475:7) (node:5828) 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)

I got this error when I made a Room with IPFS node. How to solve this?

@cervoneluca
Copy link

I've got the same error with the following code:

import IPFS from 'ipfs';
import Room from 'ipfs-pubsub-room';

const repo = () => (
  `/ipfs/repo/${Math.random()}`
);

// create IPFS node
const ipfs = new IPFS({
  repo: repo(),
  EXPERIMENTAL: {
    pubsub: true,
  },
});

const room = new Room(ipfs, 'ipfs-pubsub-demo');

room.on('peer joined', (peer) => console.log(`peer ${peer} joined`));
room.on('peer left', (peer) => console.log(`peer ${peer} joined`));

ipfs.once('ready', () => ipfs.id((err, info) => {
  if (err) { throw err; }
  console.log(`IPFS node ready with address: ${info.id}`);
}));```

@oed
Copy link

oed commented Feb 9, 2020

This seems to be because this library is expecting a newer version of js-libp2p. See changelog here: https://github.com/libp2p/js-libp2p/releases (api was changed from libp2p.pubsub.peers to libp2p.pubsub.getSubscribers)

You can solve this issue by downgrading to ipfs-pubsub-room@1.4.1 until the new version of js-ipfs that has the updated js-libp2p has been released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants