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

"peerId must be an instance of peer-id" on webpack'd version of js-ipfs #3284

Closed
aphelionz opened this issue Sep 14, 2020 · 6 comments
Closed
Labels
need/triage Needs initial labeling and prioritization

Comments

@aphelionz
Copy link
Contributor

  • Version: 0.50.2

  • Platform: Browser via mocha-headless-chrome

  • Subsystem: libp2p

Severity: High

Description:

Running the tests for orbit-db-store, I find that this test works fine in node.js but when run in the browser (via minified webpack), it gives me the error: peerId must be an instance of peer-id

  1. Test: https://github.com/orbitdb/orbit-db-store/blob/fix/replication-tests/test/replicator.spec.js
  2. Webpack Config: https://github.com/orbitdb/orbit-db-store/blob/fix/replication-tests/conf/webpack.tests.config.js
  3. PR (see CircleCI tests) Adding replication tests orbitdb-archive/orbit-db-store#98

Steps to reproduce the error:

$ git clone https://github.com/orbitdb/orbit-db-store
$ cd orbit-db-store
$ make rebuild

Or you can view the error here in the CircleCI test results. https://app.circleci.com/jobs/github/orbitdb/orbit-db-store/573

@aphelionz aphelionz added the need/triage Needs initial labeling and prioritization label Sep 14, 2020
@achingbrain
Copy link
Member

Do you have multiple versions of peer-id in your dependency tree? There should be only 0.14.1.

@achingbrain
Copy link
Member

How do I repro this? I did:

$ git clone https://github.com/orbitdb/orbit-db-store
$ cd orbit-db-store
$ make rebuild
$ npm test

It ran the tests in node and mocha-headless-chrome and they passed. Doing the install has modified the package-lock.json file though.

@aphelionz
Copy link
Contributor Author

aphelionz commented Sep 14, 2020

ah sorry - git checkout fix/replciation-tests

@aphelionz
Copy link
Contributor Author

Also npm ls peer-id shows 0.14.1 across the board

@achingbrain
Copy link
Member

achingbrain commented Sep 14, 2020

peerId is undefined - the tests are trying to get two browser nodes that don't have any listening addresses to dial each other (the .addresses array is empty).

That this worked previously may be something to do with the upgrade to [email protected] in the latest js-ipfs (cc @vasco-santos). <- edit, this hasn't worked previously, the test is new..

You may need to spin up a webrtc-star signalling server as part of the test so they can dial each other - we do something similar in our tests.

@aphelionz
Copy link
Contributor Author

Ahhhhh of course. This can be closed. I know what to do. Thank you!

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

No branches or pull requests

2 participants