-
Notifications
You must be signed in to change notification settings - Fork 1.2k
ipfs.dag.get error #3854
Comments
Thank you for submitting your first issue to this repository! A maintainer will be here shortly to triage and review.
Finally, remember to use https://discuss.ipfs.io if you just need general support. |
The const { create } = require('ipfs-http-client')
const { CID } = require('multiformats/cid');
const ipfs = create({ host: '127.0.0.1', port: '5001', protocol: 'http' })
async function getAndLog(cid, path) {
const result = await ipfs.dag.get(CID.parse(cid), { path })
}
getAndLog('bafyreicyer3d34cutdzlsbe2nqu5ye62mesuhwkcnl2ypdwpccrsecfmjq', 'a').then((ret) => {
console.log(ret)
}); |
Thanks for the answer, the reason is found, there is no return value in the getAndLog function, so "undefined" is always printed. Sorry to bother you. |
The reason is found, there is no return value in the getAndLog function, so "undefined" is always printed. |
Regarding the BUG in ipfs.dag.get, the sample code in the ipfs.dag.get part of https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md cannot be run normally.
The following code can run normally and get the hash value: bafyreicyer3d34cutdzlsbe2nqu5ye62mesuhwkcnl2ypdwpccrsecfmjq
Then use the hash value obtained and use the code in the example to get the data, and an error will be reported: No codec found for "undefined".code show as below:
I tried several times and found that it was a cid problem. After modifying the code, I tried to run again, no more errors were reported, but the output value is always: undefined.code show as below:
Use the cli command directly to obtain the data, and the data can be obtained normally.
Why is this so?
The text was updated successfully, but these errors were encountered: