nhost / hasura-backend-plus

🔑Auth and 📦Storage for Hasura. The quickest way to get Auth and Storage working for your next app based on Hasura.

Home Page:https://nhost.github.io/hasura-backend-plus/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Storage Rules not loading

Destreyf opened this issue · comments

I have a docker-compose stack setup for development, and cannot seem to get it to load the custom rules, I've gone as far as logging into the docker container itself, creating the storage-rules directory, and a rules.yaml file, and I still get the "No custom storage security rules found." message.

Running v2.5.1 currently.

relevant docker-compose snippet:

version: '3.9'
services:
  .... // Other Containers
  hasura-backend-plus:
    image: nhost/hasura-backend-plus:v2.5.1
    ports:
      - '9001:9001'
    depends_on:
      - graphql
      - minio
    restart: "unless-stopped"
    environment:
      PORT: 9001
      HASURA_GRAPHQL_ENDPOINT: http://graphql:8888/v1/graphql
      HASURA_ENDPOINT: http://graphql:8888/v1/graphql
    env_file:
      - ./.env.development
    volumes:
      - ./apps/hasura/custom:/app/custom

And my file structure:
image

Here's the directory within the container which you can clearly see exists
image

I also verified that the contents of the file are correct, and that it's valid YAML using several different validation tools

functions:
  isAuthenticated: 'return !!request.auth'
  isOwner: "return !!request.auth && userId === request.auth['user-id']"
  validToken: 'return request.query.token === resource.Metadata.token'
paths:
  /user/:userId/:
    list: 'isOwner(userId)'
  /user/:userId/:fileId:
    read: 'isOwner(userId) || validToken()'
    write: 'isOwner(userId)'
  /public/:
    list: 'true'
  /public/:fileId:
    read: 'true'
    write: 'true'

Even though the YAML linters i was using said the file was correct, there was a space before functions, which caused it to not load properly!