nhost / hasura-storage

Storage for Hasura built on top of S3

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Setting `bucket_id` permission causes 500

elitan opened this issue · comments

I'm setting the following permissions:

{
  "bucket_id": {
    "_eq" : "documents"
  }
}

And uploading a file like this:

    const { fileMetadata, error } = await nhost.storage.upload({
      file,
      bucketId: "documents",
    });

The request is sent with the documents header like this:

x-nhost-bucket-id: documents

I've also created a bucket called documents with the same data as the default default.

Server logs:

time="2022-06-24T12:00:59Z" level=error msg="call completed with some errors" client_ip=172.17.0.1 errors="[problem processing request: problem initializing file metadata: Message: check constraint of an insert/update permission has failed, Locations: []]" latency_time=18.060584ms method=POST status_code=500 url=/v1/files
commented

It seems to me that in hasura console you need to go to data -> <databases> -> storage -> buckets -> permissions and add the user role with insert/update permissions

I can't reproduce with the latest version. All is good. I've also updated the docs with information about permissions here: https://docs.nhost.io/platform/storage#permissions