Version:
0.50.2
Platform:
Darwin XXXX 19.5.0 Darwin Kernel Version 19.5.0: root:xnu-6153.121.2~2/RELEASE_X86_64 x86_64
Subsystem:
The affected core module is the http part of theipfs core. The code that I pinpointed is here.
High - The main functionality of the application does not work, API breakage, repo format breakage, etc.
In situation where ipfs-http-client uses dag-jose codec as a format, the IPFS instance cannot respond, since it cannot find the codec even if it's registered on bootstrap of the instance:
{
ipld: {formats: [dagJoseFormat]}
}
Note: formats are added to theIPFS node and ipfs-http-client both.
Creating the ipfs-http-client:
import dagJose from 'dag-jose'
import multiformats from 'multiformats/basics'
import legacy from 'multiformats/legacy'
multiformats.multicodec.add(dagJose)
const format = legacy(multiformats, dagJose.name)
const ipfsClient = ipfsClient({
url: opts.ipfsHost, ipld: { formats: [format] }
})
Creating the IPFS instance:
import dagJose from 'dag-jose'
import multiformats from 'multiformats/basics'
import legacy from 'multiformats/legacy'
multiformats.multicodec.add(dagJose)
const format = legacy(multiformats, dagJose.name)
const ipfs = await Ipfs.create({ ipld: { formats: [format] } })
The IPFS instance cannot find the codec for the payload sent via ipfs-http-client.
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.
So the issue seems to be that only hard coded codecs are used here: https://github.com/ipfs/js-ipfs/blob/3a0db1aa0229ecf6b719cc4eae4a98e5b56e4da3/packages/ipfs/src/http/api/resources/dag.js#L209-L213
When what should happen is that it should use the codecs provided as a config option to the ipfs constructor.
I've opened a PR which enables passing custom formats to solve the issue.
With custom codec support in 0.52, https://github.com/ipfs/js-ipfs/tree/ipfs%400.52.0/examples/custom-ipld-formats, can this be closed now?
yep!