Couldn't rewrite query getUser because Argument (username) of getUser was not able to be parsed as a string

I’m running into an issue where optional parameters are throwing an error with dgraph:

"message": "couldn't rewrite query getUser because Argument (username) of getUser was not able to be parsed as a string",

On query:

query getUser($email: String $username: String) {
  getUser(email: $email, username: $username) {
    id
    email
  }
}

Variables: { "email": "dfaadfs@dfssdfjk.com" }

The problem goes away when I include a "username": "..." in the variables. These are optional fields, and shouldn’t require the presence of ALL fields for the query to work.

Does this make sense?

May just be a copy paste error and unrelated to the problem, but there’s a comma missing after String, before $username in the query signature.

getUser doesn’t make sense without at least one of the variables specified, and I’m not sure what dgraphs behavior is if you try and pass two id fields to the getter; perhaps it just expects them both to match.

In terms of the actual problem, the exclamation mark means not null, rather than optional, so it’s possible dgraph is expecting there to be a variable passed, albeit with a null value.

I don’t know what different clients do in terms of sending nullable variables if not provided.