GraphQL does not report parsing errors
I see this useless message reported in many situations: Cannot query field "{some field}" on type "RootQuery".
There's actual errors underneath that are not being reported. FieldsOnCorrectTypeRule is reporting graphql errors but none of these are surfaced to the caller.
gqlerrors.FormattedError{Message:"Oracle fields must be an object with field names as keys or a function which return such an object."
While these are server errors and not actionable by the client, they should at least be logged when encountered.
The actual error was this
var oracleType = graphql.NewObject(graphql.ObjectConfig{
Name: "Oracle",
Fields: &graphql.Fields{}
}
Error goes away when changed to this
var oracleType = graphql.NewObject(graphql.ObjectConfig{
Name: "Oracle",
Fields: graphql.Fields{}
}
I had an error similar to this. But it was caused by the name of the object. Works well
var UserType = graphql.NewObject(graphql.ObjectConfig{
Name: "User",
Fields: graphql.Fields{}
})
Does not work.
var UserType = graphql.NewObject(graphql.ObjectConfig{
Name: "User type",
Fields: graphql.Fields{}
})
Eventually, this type breaks the mutation in my case.
{
"data": null,
"errors": [
{
"message": "Cannot query field \"createUser\" on type \"RootMutation\".",
"locations": [
{
"line": 2,
"column": 3
}
]
}
]
}