I'm just learning .NET Core and GraphQL and can't get a single example from the web (and I've tried a dozen) to work. They're all using this library https://graphql-dotnet.github.io and every time I try to hit the endpoint with a valid GraphQL query I get the following response:
{
"errors": [
{
"message": "Unmapped selection Field",
"extensions": {
"code": "EXECUTION_ERROR"
}
}
]
}
One of the examples: https://github.com/mmacneil/ASPNetCoreGraphQL
I can't seem to find anything googling that error, and there's not much help with the documentation regarding that. I'm hoping for someone who has worked with the library and had the same issues.
This is the error from the result of the query executing in GraphQLController:
InnerException = {GraphQL.ExecutionError: Unmapped selection Field
at GraphQL.Language.CoreToVanillaConverter.Selection(ASTNode source)
at GraphQL.Language.CoreToVanillaConverter.SelectionSet(GraphQLSelectionSet source)
at GraphQL.Language.CoreToVanillaConverter.Operation(GraphQLOperationDefinition source)
at GraphQL.Language.CoreToVanillaConverter.AddDefinitions(GraphQLDocument source, Document target)
at GraphQL.Language.CoreToVanillaConverter.Convert(String body, GraphQLDocument source)
at GraphQL.Execution.GraphQLDocumentBuilder.Build(String body)
at GraphQL.DocumentExecuter.ExecuteAsync(ExecutionOptions options)
This is also my first post here. Let me know if you need more info.
I suspect you have a bad copy of the GraphQL-Parser NuGet package. I have also been having a similar issue and have reported it to the GraphQL-Parser issue tracker.
Try the following (assuming Visual Studio 2017):
dotnet nuget locals http-cache --clear
or dotnet nuget locals all --clear
from a command prompt.I experienced this error even inside a simple helloWorld GraphQl sample Console and also in previously cloned projects.
installing(updating) GraphQL-Parser Nuget Package from Version 3 to 4, resolved the problem.
One thing to note is that at first this package is installed as a dependency and in VS 2019 you will not see it as a separated package. But if you install version 4 manually from Nuget package Manager or by Package Manager Console, the one under GraphQL package in Visual Studio Dependency tree will also reference to it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With