Skip to content
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

Casting Error in GraphQL C# Library #600

Open
lavanyadeepak opened this issue Nov 22, 2023 · 4 comments
Open

Casting Error in GraphQL C# Library #600

lavanyadeepak opened this issue Nov 22, 2023 · 4 comments

Comments

@lavanyadeepak
Copy link

lavanyadeepak commented Nov 22, 2023

We are facing a piquant situation using GraphQLClient's SendQueryAsync method to call Monday.com API. The line goes like this

var response = await graphQLClient.SendQueryAsync(request)

If the server returns a proper JSON it is all fine. However if the server returns a message like Complexity budget exhausted, query cost 30001 budget remaining 29984 out of 1000000 reset in 8 seconds, it throws a message like

Error converting value Complexity budget exhausted, query cost 30001 budget remaining 29984 out of 1000000 reset in 8 seconds to type GraphQL.GraphQLError. Path errors[0] line 1 position 305

How do we configure this graphqlclient to cast the string into GraphQL Error or are we missing something else?

@Shane32 Shane32 transferred this issue from graphql-dotnet/graphql-dotnet Nov 22, 2023
@rose-a
Copy link
Collaborator

rose-a commented Nov 22, 2023

Hi, could you post the complete HTTP response you get when this issue occurs?

@lavanyadeepak
Copy link
Author

lavanyadeepak commented Nov 22, 2023

GraphQLResponse<dynamic> response is NULL. However captured using Fiddler as below

149
{"error_code":"ComplexityException","status_code":429,"error_message":"Complexity budget exhausted, query cost 30001 budget remaining 19986 out of 1000000 reset in 3 seconds","error_data":{},"errors":["Complexity budget exhausted, query cost 30001 budget remaining 19986 out of 1000000 reset in 3 seconds"],"account_id":2213213}
0

Formatted JSON Output (for readability)

{
    "error_code": "ComplexityException",
    "status_code": 429,
    "error_message": "Complexity budget exhausted, query cost 30001 budget remaining 19986 out of 1000000 reset in 3 seconds",
    "error_data": {},
    "errors": [
        "Complexity budget exhausted, query cost 30001 budget remaining 19986 out of 1000000 reset in 3 seconds"
    ],
    "account_id": 2213213
}

@rose-a
Copy link
Collaborator

rose-a commented Nov 22, 2023

The response does not adhere to the GraphQL Spec.

The errors entry is expected to contain a list of maps, which must have at least the property message containing a description string. Thats why the deserialization fails.

It is currently not possible to use a custom GraphQLResponse type, the only way would be to clone the code and build yourself a custom version of this library.

@codyfrisch
Copy link

The response does not adhere to the GraphQL Spec.

I called this out to the OP in the monday.com community as well. monday.com refuses to acknowledge they do not follow the spec for errors as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants