Hey, I am having an issue with permission query H...
# prisma-whats-new
t
Hey, I am having an issue with permission query Here’s my Profile type:
Copy code
type Profile @model {
  id: ID! @isUnique
  name: String!
  …
  owner: User! @relation(name: "UserOnProfile")
}
In graphcool.yml I have defined following permissions:
Copy code
permissions:
- operation: Profile.update
  authenticated: true
  query: ./permissions/updateProfile.graphql
Here’s the contents of my permission query:
Copy code
query permitProfileUpdate($node_id: ID!, $user_id: ID!) {
  SomeProfileExists(filter: {
    id: $node_id,
    owner: {
      id: $user_id
    }
  })
}
This is the update mutation I am trying to run:
Copy code
mutation UpdateProfileName($id: ID!, $name: String!) {
  updateProfile(id: $id, name: $name) {
    id
  }
}
And this is the error i am getting:
"Permission Query is invalid. Could not be parsed. Error Message: Syntax error while parsing GraphQL query. Invalid input \"query ($node_id: ID, $user_id: ID) q\", expected OperationDefinition, FragmentDefinition or TypeSystemDefinition (line 1, column 1):\nquery ($node_id: ID, $user_id: ID) query permitProfileUpdate($node_id: ID!, $user_id: ID!) {\n^"
What am i doing wrong?
a
Which version of the graphcool cli are you using? You can run
graphcool version
to get this information.
t
graphcool/1.4.0
n
there's currently a problem with creating/updating permission queries. see (https://github.com/graphcool/graphcool/issues/703) and here (https://github.com/graphcool/graphcool/issues/602)
please use this permission query instead (no header):
Copy code
{
  SomeProfileExists(filter: {
    id: $node_id,
    owner: {
      id: $user_id
    }
  })
}
👍 2
t
Works like a charm, thx!
🎉 1