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

Hi there!

After days of debugging I just cannot figure out why my query is not working. This is the setup:

Scheme

type Chat {
  chat_id: Int! @id
  messages: [Message] @hasInverse(field: chat)
  title: String @search(by: [term, fulltext])
}

type Message {
  chat: Chat!
  message: String! @search(by: [term, fulltext])
  message_id: Int! @id
  timestamp: DateTime!
  user: User!
}

type User {
  messages: [Message] @hasInverse(field: user)
  user_id: Int! @id
  username: String
}

Query

query getChat($x: Int!) {
  getChat (chat_id: $x) {
    chat_id
    title
    messages { message }
  }
}

Variables

{"x": 1173233405}

Error

couldn’t rewrite query getChat because Argument (chat_id) of getChat was not able to be parsed as a string

Putting the chat_id directly into the query does work:

query getChatQuery {
  getChat(chat_id: 1173233405) {
    chat_id
    title
    messages { message }
  }
}

But separating the query and variables does not. Does anybody have any clue what I’m doing wrong?

Turns out that @id declarations can only be assigned to Strings types…

Fields with the @id directive must have the type String! .

https://dgraph.io/docs/graphql/schema/ids/

depends on what version you are on…

  • Fix(GraphQL): adding support for @id with type other than strings (#7019)

v21.03

It looks like you have found a bug. What you posted in your OP should work. You should report this, to where, idk… Maybe wait for the new CTO? Maybe post on Github issues? @akon where and how do you want issues reported?

Please file a github issue and put a link to it in this thread. We will begin addressing the issues soon.