ipfs / js-ipfs

IPFS implementation in JavaScript
https://js.ipfs.tech
Other
7.44k stars 1.25k forks source link

Error when publishing IPNS entry #4202

Closed tknoch-symphony closed 1 year ago

tknoch-symphony commented 2 years ago

Hello, I'm a rookie in IPFS world so please take that into account.

Severity:

Description:

I successfully ran a IPFS node on my nestjs API using js-ipfs (ipfs-core). When trying to publish a IPNS record, I get the following error:

Error: ipns record for f5uxa3ttf4acicabciqhcqrufyvadw2s7tyk2lp7tiaca737jtwpi6sjeiwzv4xqpsmwehi could not be stored in the routing - Error: Write failed
    at Object.dbWriteFailedError (/Users/tiagoknoch/source/nestjs-tutorial/mycv/node_modules/datastore-core/cjs/src/errors.js:20:16)
    at TieredDatastore.put (/Users/tiagoknoch/source/nestjs-tutorial/mycv/node_modules/datastore-core/cjs/src/tiered.js:34:20)
    at IpnsPublisher._publishEntry (/Users/tiagoknoch/source/nestjs-tutorial/mycv/node_modules/ipfs-core/cjs/src/ipns/publisher.js:85:19)
    at IpnsPublisher._putRecordToRouting (/Users/tiagoknoch/source/nestjs-tutorial/mycv/node_modules/ipfs-core/cjs/src/ipns/publisher.js:67:5)

Code sample:

  async test() {
    const ipfs = await create();
    const file = await ipfs.add({
      path: 'text.txt',
      content: new TextEncoder().encode(
        'Hello World ' + new Date().toISOString(),
      ),
    });
    const addr = `/ipfs/${file.cid.toString()}`;
    const res = await this.node.name.publish(addr);
    console.log(`https://gateway.ipfs.io/ipns/${res.name}`);
  }
welcome[bot] commented 2 years ago

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:

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

mbutan commented 2 years ago

Hey @tknoch-symphony any progress with your issue , I am having exactly the same error.

tknoch-symphony commented 2 years ago

@mbutan no luck, as you see I got no answer, same thing in IPFS forum. Let me know if you manage something

legalizemath commented 1 year ago

I've solved this before by simply doing ipfs.stop() and ipfs.start() and retrying automatically which improves rate of it working 100s of times. as to why no idea.

algorista commented 1 year ago

I found the source of the bug and posted a solution. it's in the issue https://github.com/ipfs/js-ipfs/issues/4267

SgtPooki commented 1 year ago

js-ipfs is being deprecated in favor of Helia. You can https://github.com/ipfs/js-ipfs/issues/4336 and read the migration guide.

Please feel to reopen with any comments by 2023-06-02. We will do a final pass on reopened issues afterward (see https://github.com/ipfs/js-ipfs/issues/4336).

This issue is most likely resolved in Helia, please try it out!