Darwin - v20.11.0-gea15b664a
Context
I was trying to reproduce this
With an existing Dgraph instance. Which should be fine, as GraphQL in Dgraph has a kind of “namespacing” right? So, I have found this bug with preexisting data. I have started to do what is in the steps and then I have responses like this:
-------------- Query ----------------
query {
queryUser {
username
}
}
-------------- Response ----------------
{
"errors": [
{
"message": "Non-nullable field 'username' (type String!) was not present in result from Dgraph. GraphQL error propagation triggered.",
"locations": [
{
"line": 3,
"column": 5
}
],
"path": [
"queryUser",
0,
"username"
]
},
{
"message": "Non-nullable field 'username' (type String!) was not present in result from Dgraph. GraphQL error propagation triggered.",
"locations": [
{
"line": 3,
"column": 5
}
],
"path": [
"queryUser",
1,
"username"
]
},
{
"message": "Non-nullable field 'username' (type String!) was not present in result from Dgraph. GraphQL error propagation triggered.",
"locations": [
{
"line": 3,
"column": 5
}
],
"path": [
"queryUser",
2,
"username"
]
},
{
"message": "Non-nullable field 'username' (type String!) was not present in result from Dgraph. GraphQL error propagation triggered.",
"locations": [
{
"line": 3,
"column": 5
}
],
"path": [
"queryUser",
3,
"username"
]
},
{
"message": "Non-nullable field 'username' (type String!) was not present in result from Dgraph. GraphQL error propagation triggered.",
"locations": [
{
"line": 3,
"column": 5
}
],
"path": [
"queryUser",
4,
"username"
]
},
{
"message": "Non-nullable field 'username' (type String!) was not present in result from Dgraph. GraphQL error propagation triggered.",
"locations": [
{
"line": 3,
"column": 5
}
],
"path": [
"queryUser",
5,
"username"
]
},
{
"message": "Non-nullable field 'username' (type String!) was not present in result from Dgraph. GraphQL error propagation triggered.",
"locations": [
{
"line": 3,
"column": 5
}
],
"path": [
"queryUser",
6,
"username"
]
},
{
"message": "Non-nullable field 'username' (type String!) was not present in result from Dgraph. GraphQL error propagation triggered.",
"locations": [
{
"line": 3,
"column": 5
}
],
"path": [
"queryUser",
7,
"username"
]
},
{
"message": "Non-nullable field 'username' (type String!) was not present in result from Dgraph. GraphQL error propagation triggered.",
"locations": [
{
"line": 3,
"column": 5
}
],
"path": [
"queryUser",
8,
"username"
]
}
],
"data": {
"queryUser": [
null,
null,
null,
null,
null,
null,
null,
null,
null,
{
"username": "alice@dgraph.io"
}
]
},
"extensions": {
"touched_uids": 20,
"tracing": {
"version": 1,
"startTime": "2020-08-22T01:24:37.029328-03:00",
"endTime": "2020-08-22T01:24:37.042452-03:00",
"duration": 13122978,
"execution": {
"resolvers": [
{
"path": [
"queryUser"
],
"parentType": "Query",
"fieldName": "queryUser",
"returnType": "[User]",
"startOffset": 114310,
"duration": 12950998,
"dgraph": [
{
"label": "query",
"startOffset": 166590,
"duration": 12844688
}
]
}
]
}
}
}
}
In the beginning, I thought that I had done something wrong in the steps, but no, it was all fine on my side. I suspected that something else was wrong with the dataset. So I saw “Alice” along with several “Nulls”. So I noticed that Dgraph GraphQL was querying for existing data with other predicate name.
-------------- Query ----------------
query {
queryUser {
name
}
}
-------------- Response ----------------
{
"data": {
"queryUser": [
{
"name": null
},
{
"name": null
},
{
"name": null
},
{
"name": null
},
{
"name": null
},
{
"name": null
},
{
"name": null
},
{
"name": null
},
{
"name": null
},
{
"name": "Alice"
}
]
},
"extensions": {
"touched_uids": 20,
"tracing": {
"version": 1,
"startTime": "2020-08-22T01:29:41.162099-03:00",
"endTime": "2020-08-22T01:29:41.165061-03:00",
"duration": 2961470,
"execution": {
"resolvers": [
{
"path": [
"queryUser"
],
"parentType": "Query",
"fieldName": "queryUser",
"returnType": "[User]",
"startOffset": 90370,
"duration": 2851000,
"dgraph": [
{
"label": "query",
"startOffset": 126450,
"duration": 2766050
}
]
}
]
}
}
}
}
The weird part is that Dgraph should query for <User.name>
not <name>
and <User.name>
at the same time. This can lead to issues with existing datasets in users contexts.