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

DHT findProvs not working - Nodejs #3734

Closed
jamesrez opened this issue Jul 4, 2021 · 4 comments
Closed

DHT findProvs not working - Nodejs #3734

jamesrez opened this issue Jul 4, 2021 · 4 comments
Labels
need/triage Needs initial labeling and prioritization

Comments

@jamesrez
Copy link

jamesrez commented Jul 4, 2021

  • Version: { version: '0.8.0', repo: '10', commit: '81f944163f5a78ef15fdc23b2c488ba7f44af0be', 'interface-ipfs-core': '^0.147.0' }
  • Platform: Node.js
  • Subsystem: DHT

Severity: High

Description: cid.toBaseEncodedString is not a function

I'm following the findProvs example from the docs at https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DHT.md#example-1

const providers = ipfs.dht.findProvs('QmdPAhQRxrDKqkGPvQzBvjYe3kU8kiEEAd2J6ETEamKAD9')
for await (const provider of providers) {
  console.log(provider.id.toString())
}

When the code runs, my nodejs server crashes with this error:

/node_modules/libp2p-kad-dht/src/providers.js:202
      this._log('getProviders %s', cid.toBaseEncodedString())                                    ^
TypeError: cid.toBaseEncodedString is not a function

I wasn't sure if this was a personal problem until I found this and then I found this closed issue and it seems it was closed prematurely. So here it is again, can we solve it?

@jamesrez jamesrez added the need/triage Needs initial labeling and prioritization label Jul 4, 2021
@welcome
Copy link

welcome bot commented Jul 4, 2021

Thank you for submitting your first issue to this repository! A maintainer will be here shortly to triage and review.
In the meantime, please double-check that you have provided all the necessary information to make this process easy! Any information that can help save additional round trips is useful! We currently aim to give initial feedback within two business days. If this does not happen, feel free to leave a comment.
Please keep an eye on how this issue will be labeled, as labels give an overview of priorities, assignments and additional actions requested by the maintainers:

  • "Priority" labels will show how urgent this is for the team.
  • "Status" labels will show if this is ready to be worked on, blocked, or in progress.
  • "Need" labels will indicate if additional input or analysis is required.

Finally, remember to use https://discuss.ipfs.io if you just need general support.

@achingbrain
Copy link
Member

The problem is the example is wrong - ipfs.dht.findProvs takes a CID not a string.

It's a quick fix to update the docs, would you like to open a PR that does so?

@jamesrez
Copy link
Author

jamesrez commented Jul 4, 2021

The problem is the example is wrong - ipfs.dht.findProvs takes a CID not a string.

It's a quick fix to update the docs, would you like to open a PR that does so?

No. It gives the same error even if you pass a CID. Not a quick fix

@lidel
Copy link
Member

lidel commented Jul 9, 2021

Continued in #3502

@lidel lidel closed this as completed Jul 9, 2021
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

3 participants