Invalid use of comma

Report a GraphQL Bug

What edition and version of Dgraph are you using?

Edition:

  • SlashGraphQL
  • Dgraph (community edition/Dgraph Cloud)

If you are using the community edition or enterprise edition of Dgraph, please list the version:

Dgraph Version
v20.11.0-11-gb36b4862

Have you tried reproducing the issue with the latest release?

Not tested with 20.11.1 or master, just the latest available on Slash. My schema and data is too large to run the latest version or master version locally on Windows without a Unix server.

Steps to reproduce the issue (paste the query/schema if possible)

I can share full schema, but it is very large and has a lot of auth rules. Auth rules may have something to do with this error.

query:

query EventContacts {
  block1: queryEventOccurance(filter: {start: {le: "2021-02-22T15:35:00.000Z"}}) {
    event {
      id
      at(filter: {id: "0x27277"}) {
        id
      }
    }
  }
}

Expected behaviour and actual result.

Expected:

{
  "data": {
    "block1": [
      {
        "event": {
          "at": {
            "id": "0x27277"
          }
        }
      },
      ...

Actual:

{
  "errors": [
    {
      "message": "Dgraph query failed because Dgraph execution failed because line 18 column 36: Invalid use of comma."
    }
  ],
  ...

I can bypass this error by changing the filter to a list instead of depending on Dgraph to coerce to a list.

as(filter: {id:["0x27277"]})

I thought this was fixed on my version, but maybe that is a later version.


Helpful debug advice:

To help debug errors like this, is there anyway to see the converted DQL from a GraphQL query/mutation? That would really be helpful if there was a way to enter a GraphQL query/mutation and output it to DQL from my schema. The rewriter functions have this DQL, just not sure how to get it without possibly going to look in the logs somewhere (which is not available in Slash)

@amaster507 can you shoot me the schema? I wanna try reproducing this to see

Hi @amaster507 ,

I am able to reproduce this error with the below schema and query on version v20.11.0-11-gb36b4862
Schema:

type Post {                                                                     
    title: String! @search(by: [term, fulltext])                                
    post1: [Post1]                                                              
}                                                                               
                                                                                
type Post1 {                                                                    
    id: ID!                                                                     
    name: String!                                                               
}

Query:

query{
  b1: queryPost{
    title
    post1(filter:{id:"0x27277"}){
      name
    }
  }
}

I also tried reproducing this on latest branch release/v21.03, but couldn’t . This has been fixed with coercing of ID filters to list. I also checked the DQL query formed for this GraphQL query and it was well formed on release/v21.03 .

There is no way to do this in slash currently. On community editions, you may try running dgraph alpha with -v=3 flag. It will then also show the converted DQL query for every GraphQL query / mutation in the logs.