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

dht.provide() doesn't accept strings #2573

Closed
reasv opened this issue Oct 29, 2019 · 6 comments
Closed

dht.provide() doesn't accept strings #2573

reasv opened this issue Oct 29, 2019 · 6 comments
Labels
exp/novice Someone with a little familiarity can pick up P4 Very low priority status/ready Ready to be worked

Comments

@reasv
Copy link
Contributor

reasv commented Oct 29, 2019

  • master:
  • Chrome/Windows:
  • DHT:

Type:

Bug

Severity:

Medium

Description:

ipfs.dht.provide() doesn't accept a string as input. It exclusively accepts a CID instance object.

This is inconsistent with how dht.findProvs() works, and it's not even hinted at in the documentation.

The error returned for giving it a string is "not a valid CID" which is also very opaque and confusing.

I would suggest to either update the documentation or to modify the function to do something like const cid = new CID(string_argument) in order to support a string-based argument.

@reasv
Copy link
Contributor Author

reasv commented Oct 29, 2019

I would also like to add that the other errors it's giving me are rather opaque.
Uncaught (in promise) Error: Failed to provide to 7 of 20 peers
It's not really clear what this means or how it happened

@reasv
Copy link
Contributor Author

reasv commented Oct 29, 2019

I can make a pull request with the fix I proposed if you think that it would be ok

@alanshaw
Copy link
Member

alanshaw commented Nov 4, 2019

🙏 yes please @reasv - it would also be good to get an update to the docs if you have time! ❤️

@alanshaw alanshaw added exp/novice Someone with a little familiarity can pick up P4 Very low priority status/ready Ready to be worked labels Nov 4, 2019
@reasv
Copy link
Contributor Author

reasv commented Nov 4, 2019

Ok. I will do this later today or tomorrow.

@reasv
Copy link
Contributor Author

reasv commented Nov 6, 2019

@alanshaw #2589

alanshaw pushed a commit that referenced this issue Nov 11, 2019
* dht.provide() should accept string keys (#2573)

* FIx linting issues

* chore: update interface-ipfs-core dep
@alanshaw
Copy link
Member

resolved by #2589

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
exp/novice Someone with a little familiarity can pick up P4 Very low priority status/ready Ready to be worked
Projects
None yet
Development

No branches or pull requests

2 participants