graphql / graphql.github.io

GraphQL Documentation at graphql.org
https://graphql.org
MIT License
836 stars 1.43k forks source link

Feedback for “Serving over HTTP” #1771

Closed leandrodantediaz closed 2 months ago

leandrodantediaz commented 2 months ago

I have a graphl API with .NET 6. The problem is that whenever there is an error it returns 500 and not 200. This is my server:

builder.Services.AddGraphQLServer() .RegisterDbContext(DbContextKind.Pooled) .AddQueryType() .AddMutationType() .AddUploadType() .AddFiltering() .AddSorting() .AddAuthorization() .AddProjections() .AddErrorFilter() .SetPagingOptions(new PagingOptions { MaxPageSize = 100 }) .SetRequestOptions(_ => new HotChocolate.Execution.Options.RequestExecutorOptions { ExecutionTimeout = TimeSpan.FromMinutes(10) });

What could I be doing wrong?

benjie commented 2 months ago

This issue should probably be asked of HotChocolate instead. cc @michaelstaib

michaelstaib commented 2 months ago

With HC 13 we return a 500 whenever all fields have been erased due to non-null propagation. We have changed this behavior with HC 14 to return a 200 in these cases. Be aware that GraphQL validation and parsing errors still will yield to a 4xx. You can override this behavior in both versions with a request middleware. Connect with the community on slack.chillicream.com or on the GraphQL discord.