Error after ipfs add: no datastore mounted for this key

I’m trying to run ipfs node backed by s3.
I think I followed instructions from https://github.com/ipfs/go-ds-s3, but I’m not sure my config is valid. This might be the cause of the problem I’m facing.

When I add file with ipfs add comand i get following output:

$ docker exec -i -t b74661b71c86 /bin/bash
root@b74661b71c86:/go/src/ipfs/go-ipfs# ipfs add README.md 
2020-12-07T22:09:57.410Z	DEBUG	cmd/ipfs	config path is /root/.ipfs
added QmYTMhRvRnBLxbXPGJCVixHSBwVgtWjVJ86YHC2aATxdzp README.md
 35.20 KiB / 35.20 KiB [=======================================================================================================================================] 100.00%
Error: cannot store pin state: no datastore mounted for this key

My mounts:

      "mounts":
      [
        {
          "child": {
            "type": "s3ds",
            "region": "us-east-2",
            "rootDirectory":"data",
            "bucket": "ipfs-test",
            "regionEndpoint": "http://localhost.localstack.cloud:4566",
          },
          "mountpoint": "/blocks",
          "prefix": "s3.datastore",
          "type": "measure"
        }
      ],

Please help me resolve my problem.

You probably need to keep the levelds mount that was there originally (mountpoint: "/"), along with the s3 one, or if you want absolutely all the data on s3, and not just the blocks, change the mountpoint of this datastore to "/".

Changing to "/" results in panic:

    localhost.localstack.cloud_1  | 2020-12-22 07:25:39,699:API: 172.20.0.4 - - [22/Dec/2020 07:25:39] "GET /ipfs-test?list-type=2&max-keys=1000&prefix=data%2Fblocks HTTP/1.1" 200 -
    ipfs0                         | panic: expected prefix not found
    ipfs0                         | 
    ipfs0                         | goroutine 1011 [running]:
    ipfs0                         | github.com/ipfs/go-datastore/keytransform.PrefixTransform.InvertKey(0xc00020af48, 0x7, 0xc000fbedc0, 0x44, 0x0, 0x0)
    ipfs0                         | 	pkg/mod/github.com/ipfs/go-datastore@v0.4.5/keytransform/transforms.go:42 +0x1be
    ipfs0                         | github.com/ipfs/go-datastore/keytransform.(*Datastore).Query.func1(0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
    ipfs0                         | 	pkg/mod/github.com/ipfs/go-datastore@v0.4.5/keytransform/keytransform.go:83 +0x13a

Restoring levelds mounted to / resolves problem. Thank You

  "Spec": {
      "mounts":
      [
        {
          "child": {
            "type": "s3ds",
            "region": "us-east-2",
            "rootDirectory":"data",
            "bucket": "ipfs-test",
            "regionEndpoint": "http://localhost.localstack.cloud:4566",
          },
          "mountpoint": "/blocks",
          "prefix": "s3.datastore",
          "type": "measure"
        },
        {
          "child": {
            "compression": "none",
            "path": "datastore",
            "type": "levelds"
          },
          "mountpoint": "/",
          "prefix": "leveldb.datastore",
          "type": "measure"
        }
      ],
      "type": "mount"
    }