I'm using the new CLI, doing this query ```query {...
# prisma-whats-new
l
I'm using the new CLI, doing this query
Copy code
query {
  User(id: "cj8eurgqf30sc0112k3b6dkfl") {
    email
  }
}
With this permission query
Copy code
query ($user_id: ID!, $node_id: ID!) {
  SomeUserExists(
    filter: {
      id: $user_id
      OR:[{
        id: $node_id
      }, {
        role: ADMIN
      }, {
        ownedCourses_some: {
          enrolledStudents_some: {
            id: $node_id
          }
        }
      }]
    }
  )
}
And I get this error:
Copy code
{
  "data": {
    "User": {
      "email": null
    }
  },
  "errors": [
    {
      "locations": [
        {
          "line": 3,
          "column": 5
        }
      ],
      "path": [
        "User",
        "email"
      ],
      "code": 3008,
      "message": "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 ($user_id: ID!, $node_id: ID!) {\n^",
      "requestId": "us-west-2:simple:cj8hnqpih00000113a3usy8nu"
    }
  ]
}
It looks like there's something wrong with the parsing, I don't think my query is incorrect, it was working in the GUI console
a
Which version of the CLI are you using?
l
graphcool/0.6.0-beta.3 (linux-x64) node-v8.4.0
a
Can you re-install graphcool@next and try again?
l
Okay, I just did
🎧 1
Still has the problem as far as I can tell. I'm trying to wade through the new authentication and warnings about config files, but the problem persists when I go into the playground
a
Did you re-deploy?
l
Yes
Copy code
Deploying to shared-eu-west-1 with target default... ✔
It succeeds
It takes me to the console, I go to the playground and run the query, and get the same result
a
Could you try naming the query to see if that helps?
l
Didn't work
I named the query test, and got this:
Copy code
{
  "data": {
    "User": {
      "password": null
    }
  },
  "errors": [
    {
      "locations": [
        {
          "line": 3,
          "column": 5
        }
      ],
      "path": [
        "User",
        "password"
      ],
      "code": 3008,
      "message": "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 test($user_id: ID!, $node_id: ID!) {\n^",
      "requestId": "us-west-2:simple:cj8lrlipz00000196dgd2oacm"
    }
  ]
}
a
One sec, testing...
I can't reproduce
l
Hmmm...
This is from the graphcool.yml:
Copy code
- operation: User.read
  fields:
    - role
    - email
  authenticated: true
  query: ./permission-queries/user/user-read-role-email.graphql
a
Wait, I can reproduce
l
Yes!
l
Thank you for the help
😎 1
a
@lastmjs Just a heads up: there was an update on the GH issue. It seems the workaround is to remove the
query (...)
part from your local permission query. Then it runs successful after deploy. More details here: https://github.com/graphcool/graphcool/issues/703