-
-
Notifications
You must be signed in to change notification settings - Fork 922
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ASP.NET Core 3.1: Getting a "Query is required" error on the /graphql endpoint #1595
Comments
Incidentally, I have the same basic code working in .net core 2.2 and it's working fine. |
https://github.com/graphql-dotnet/graphql-dotnet#installation
You reference 2.3.0 version, even older one. Please upgrade to the latest preview and check again. Also you need the latest server package https://github.com/graphql-dotnet/server |
I found my answer: I had to add these lines:
My repo (data access calls) where indeed synchronous, but even when I made them async (returning Task) I still get the error without those lines above. So I think something inside the Playground logic is doing a synchronous read. Feel free to close this issue as I have a workaround, but something may need to be done inside the Playground logic. |
No. It is all about async read/write on the server side - Newtonsoft.Json serializer. Now we have new SystemTextJson package, see server repo readme. GraphQL Playground is a frontend application. |
Thanks for the clarification - I simply meant something initiated by the playground. But after updating the packages and source code the problem was eliminated. The repo that I link to above shows fully working code with the changes that i made. Thanks!!! |
Description
Getting Query is required error. I can't get the graphql endpoint working in a brand new and very simple project that uses the ASP.NET Core DI engine and an existing database.
Steps to reproduce
Current code is here: https://github.com/dahlsailrunner/northwind-core-api
It's a very simple API based on "northwind" data.
I did check this issue: #1444
but it doesn't seem to have anything that can help (or I missed it).
I've tried with the
FuncDependencyResolver
and the commented-outAddScoped<NorthwindQuery>
. Also, I have set a breakpoint in theSchema
constructor where it sets theQuery
property and it appears to get set to the proper object that I would have expected. But the error persists and doesn't let me run any actual queries.I'm running the "latest stable" versions of the packages:
The code from Startup.cs looks like this:
You can see the simple code blocks for the Query, Schema, and Type in the "Graph" folder of the repo.
Expected result
I'm just trying to get the playground running and operational.
Actual result
Here's the response I got from the /graphql endpoint:
Environment
Windows 10 - the rest is probably not important here.
The text was updated successfully, but these errors were encountered: