mrjn
(Manish R Jain)
1
query MyQuery {
getTweets(id: "1286891968727982081") {
streams
score
id
}
queryTweets(filter: {id: {eq: "1286891968727982081"}}) {
id
score
streams
}
}
This is the query. And this is the result:
"errors": [
{
"message": "Dgraph query failed because Dgraph execution failed because line 2 column 21: Invalid use of comma."
}
],
"data": {
"getTweets": null,
"queryTweets": [
{
"id": "1286891968727982081",
"score": 1242,
"streams": "golang"
}
]
},
And this is the endpoint:
https://beneficial-baseball-9463.us-west-2.aws.cloud.dgraph.io/graphql
Looks like getTweets
has a bug.
1 Like
dmai
(Daniel Mai)
2
I tried reproducing this with the following schema and query.
Schema:
type Tweets {
id: String! @id
score: Int
}
Query:
query MyQuery {
getTweets(id: "1286891968727982081") {
score
id
}
}
I see that this is the underlying Dgraph query that was executed:
query {
getTweets(func: eq(, \"1286891968727982081\")) @filter(type(Tweets)) {
score : Tweets.score
id : Tweets.id
dgraph.uid : uid
}
eq(, \"1286891968727982081\")
would explain why the error message is about a mis-use for a comma. It should have Tweets.id
there.
pawan
(Pawan Rawal)
3
The bug is because even though the field id
represents an xid and has type String!
because of its name we were considering it to be an ID.
So for example the following schema would work
type Tweets {
twitterID: String! @id
score: Int
}
Only when the name of the field with @id
directive is id
, this would break. We should have been checking for the type of the field instead of the name. I have fixed this in fix(GraphQL): Fix getType queries when id was used as a name for types other than ID by pawanrawal · Pull Request #6130 · dgraph-io/dgraph · GitHub
2 Likes