graphql-dotnet / graphql-dotnet/conventions
"GraphQL.ExecutionError: Null value provided for non-nullable argument 'field1'" - Even though it is actually not null.
- Dominant language
- C#
- Stars
- 228
- Forks
- 62
- PR merge metrics
- No merged PRs in 30d
Description
Hello again,
after I worked around #267 and then rolled out the new version, I discovered more obscure problems.
Some operations suddenly fail with the error mentioned in the title. No changes to the actual query or backend types were made.
The "ensure non null" validation seems to throw some new false positives.
If I remove the NonNull<> wrapper from that field it executes again, and there actually is a value!
This only happens on some operations. The thing that stands out about them is their complexity.
Looking at the request body, it's an operation with variables, which calls a query with one of the variables, and includes a fragment, which also uses a variable on one of it's methods.
An example:
```
query getStuffAndMore($var1: [String!]!, $var2: [String!]!, $var3: String) {
getStuff(path: $var2, filter: $var3) {
...Fragment1
...on ErrorInfo {
errorMessage
errorCode
__typename
}
__typename
}
}
fragment Fragment1 on UnionType1 {
more(field1: $var1)
}
```
I worked around it for now by removing the NonNull<> wrapper on the effected methods on the server side and instead added ArgumentNullException.ThrowIfNull() to the first line.
GraphQL: 8.2.1
GraphQL.Server.Transports.AspNetCore: 8.2.0
GraphQL.Convetions: 8.0.0
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.