DEV Community

Discussion on: Getting started with GraphQL in .NET 6 - Part 2 (Query + Mutation to Database)

Collapse
 
francescoosato profile image
francescoosato

Running your github code I get the following exception:

InvalidOperationException: Cannot execute request if no query is specified
GraphQL.DocumentExecuter.ExecuteAsync(ExecutionOptions options) in DocumentExecuter.cs
GraphQL.Server.DefaultGraphQLExecuter.ExecuteAsync(string operationName, string query, Inputs variables, IDictionary context, IServiceProvider requestServices, CancellationToken cancellationToken) in DefaultGraphQLExecuter.cs
GraphQL.Server.Transports.AspNetCore.GraphQLHttpMiddleware.InvokeAsync(HttpContext context) in GraphQLHttpMiddleware.cs
Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

Any idea?
Thanks

Collapse
 
berviantoleo profile image
Bervianto Leo Pratama

Do you send any queries?

I've tried with valid query and don't have any problems.

Altair

You can use (your ip)/ui/altair to try the GraphQL.

You will get that error when try to access directly without send any "query".

Access Directly

Collapse
 
francescoosato profile image
francescoosato

Sorry it was my mistake. Your solution works properly.

Thread Thread
 
berviantoleo profile image
Bervianto Leo Pratama

You don't need to be sorry. It's great when people ask me to solve their problems.