Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redundant authorization error messages #80

Open
anasbarg opened this issue Nov 26, 2020 · 0 comments
Open

Redundant authorization error messages #80

anasbarg opened this issue Nov 26, 2020 · 0 comments
Assignees
Labels
authorizer bug Something isn't working P1 Important but not urgent

Comments

@anasbarg
Copy link
Collaborator

Redundant authorization error messages

Pragmafile: https://gist.github.com/anasbarg/f5617d17e45e35488689408322e14a16

Problem

When I try to run the following query on the above schema:

query GetProduct($id: String!) {
  Product {
    read(id: $id) {
      	id
        name {
          ar
          en
        }
        prices {
          currency {
            name {
              ar
              en
            }
            code
          }
          value
        }
        questions {
          index
          id
          name {
            ar
            en
          }
          type
          isRequired
          options {
            id
            name {
              ar
              en
            }
            changeInPrice
          }
          changeInPrice
        }
        imageUrl
        description {
          ar
          en
        }
        discountCodes {
          code
          amount
          discountType
          minimumTotal
          expiresAt
          createdAt
        }
      }
  }
}

I get the following response:

{
  "errors": [
    {
      "message": "No `allow` rule exists that allows `READ` operations on `Product`for role `Business`"
    },
    {
      "message": "No `allow` rule exists that allows `READ` operations on `Product`for role `Business`"
    },
    {
      "message": "No `allow` rule exists that allows `READ` operations on `Localized`for role `Business`"
    },
    {
      "message": "No `allow` rule exists that allows `LIST` operations on `Price`for role `Business`"
    },
    {
      "message": "No `allow` rule exists that allows `LIST` operations on `Question`for role `Business`"
    },
    {
      "message": "No `allow` rule exists that allows `READ` operations on `Product`for role `Business`"
    },
    {
      "message": "No `allow` rule exists that allows `READ` operations on `Localized`for role `Business`"
    },
    {
      "message": "No `allow` rule exists that allows `LIST` operations on `DiscountCode`for role `Business`"
    }
  ]
}

Which are all caused by the first error (no allow READ Product on Business), because when I add it all errors disappear.

Expected

Only the parent error should be returned.

@anasbarg anasbarg added authorizer bug Something isn't working P1 Important but not urgent labels Nov 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
authorizer bug Something isn't working P1 Important but not urgent
Projects
None yet
Development

No branches or pull requests

2 participants