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

dag.put does not work in the js ipfs daemon with cbor-style input, even though the same request works with go-ipfs #2825

Closed
@pcowgill

Description

@pcowgill

I'm creating this issue here for a ipfs-http-client problem since this repo is turning into a monorepo.

Error when doing this:

const cbor = { foo: "dag-cbor-bar" };

const cid = await ipfs.dag.put(cbor, {
  format: "dag-cbor",
  hashAlg: "sha2-256"
});

That's similar to what is done in the dag.put tests, so it should be working.

This error occurs in a browser env, for instance when using js-ipfs-http-client from a create-react-app app

Found the root of the issue by hitting a local js-ipfs daemon in debug mode DEBUG=ipfs* js-ipfs-local daemon where js-ipfs-local is my zsh alias for the local js-ipfs version.

The problem is in borc via js-ipld-dag-cbor.

https://github.com/dignifiedquire/borc/blob/b6bae8b0bcde7c3976b0f0f0957208095c392a36/src/decoder.js#L547

On the browser side, it looks like this:

Uncaught (in promise) HTTPError: Input too short
    at errorHandler (http://localhost:3000/static/js/0.chunk.js:15327:17)
    at async fn (http://localhost:3000/static/js/0.chunk.js:12038:36)
    at async Promise.Ky.result.<computed> [as json] (http://localhost:3000/static/js/0.chunk.js:12074:19)
    at async Object.put (http://localhost:3000/static/js/0.chunk.js:13484:17)
    at async dagPut (http://localhost:3000/static/js/main.chunk.js:147:17)

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedSeeking public contribution on this issuekind/bugA bug in existing code (including security flaws)status/readyReady to be worked

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions