Query for introspection field __typename throws an exception if MaxQueryComplexityInstrumentation is used
See original GitHub issueIf MaxQueryComplexityInstrumentation
is used - my setup is as the following:
GraphQL.newGraphQL(schema)
.queryExecutionStrategy(queryExecutionStrategy())
.mutationExecutionStrategy(mutationExecutionStrategy())
.instrumentation(
new MaxQueryComplexityInstrumentation(MAX_FIELDS_IN_QUERY)
)
.build();
any query containing __typename
introspection field throws the following exception:
java.lang.IllegalStateException: introspection field __typename doesn't have a fields container
at graphql.analysis.QueryVisitorFieldEnvironmentImpl.getFieldsContainer(QueryVisitorFieldEnvironmentImpl.java:76) ~[graphql-java-10.0.jar!/:na]
at graphql.analysis.MaxQueryComplexityInstrumentation.convertEnv(MaxQueryComplexityInstrumentation.java:111) ~[graphql-java-10.0.jar!/:na]
at graphql.analysis.MaxQueryComplexityInstrumentation.calculateComplexity(MaxQueryComplexityInstrumentation.java:99) ~[graphql-java-10.0.jar!/:na]
at graphql.analysis.MaxQueryComplexityInstrumentation.access$000(MaxQueryComplexityInstrumentation.java:22) ~[graphql-java-10.0.jar!/:na]
at graphql.analysis.MaxQueryComplexityInstrumentation$1.visitField(MaxQueryComplexityInstrumentation.java:65) ~[graphql-java-10.0.jar!/:na]
at graphql.analysis.QueryTraversal$NodeVisitorImpl.visitField(QueryTraversal.java:271) ~[graphql-java-10.0.jar!/:na]
at graphql.language.Field.accept(Field.java:165) ~[graphql-java-10.0.jar!/:na]
at graphql.language.NodeTraverser$1.leave(NodeTraverser.java:72) ~[graphql-java-10.0.jar!/:na]
at graphql.util.Traverser.traverse(Traverser.java:83) ~[graphql-java-10.0.jar!/:na]
at graphql.language.NodeTraverser.doTraverse(NodeTraverser.java:151) ~[graphql-java-10.0.jar!/:na]
at graphql.language.NodeTraverser.depthFirst(NodeTraverser.java:76) ~[graphql-java-10.0.jar!/:na]
at graphql.analysis.QueryTraversal.visitImpl(QueryTraversal.java:178) ~[graphql-java-10.0.jar!/:na]
at graphql.analysis.QueryTraversal.visitPostOrder(QueryTraversal.java:96) ~[graphql-java-10.0.jar!/:na]
at graphql.analysis.MaxQueryComplexityInstrumentation.lambda$beginValidation$1(MaxQueryComplexityInstrumentation.java:58) ~[graphql-java-10.0.jar!/:na]
at graphql.execution.instrumentation.SimpleInstrumentationContext.onCompleted(SimpleInstrumentationContext.java:37) ~[graphql-java-10.0.jar!/:na]
at graphql.execution.instrumentation.ChainedInstrumentation$ChainedInstrumentationContext.lambda$onCompleted$1(ChainedInstrumentation.java:237) ~[graphql-java-10.0.jar!/:na]
at java.base/java.util.ArrayList.forEach(ArrayList.java:1378) ~[na:na]
at java.base/java.util.Collections$UnmodifiableCollection.forEach(Collections.java:1081) ~[na:na]
at graphql.execution.instrumentation.ChainedInstrumentation$ChainedInstrumentationContext.onCompleted(ChainedInstrumentation.java:237) ~[graphql-java-10.0.jar!/:na]
at graphql.GraphQL.validate(GraphQL.java:541) ~[graphql-java-10.0.jar!/:na]
at graphql.GraphQL.parseAndValidate(GraphQL.java:509) ~[graphql-java-10.0.jar!/:na]
at graphql.GraphQL.lambda$parseValidateAndExecute$3(GraphQL.java:490) ~[graphql-java-10.0.jar!/:na]
at graphql.execution.preparsed.NoOpPreparsedDocumentProvider.get(NoOpPreparsedDocumentProvider.java:11) ~[graphql-java-10.0.jar!/:na]
at graphql.GraphQL.parseValidateAndExecute(GraphQL.java:486) ~[graphql-java-10.0.jar!/:na]
at graphql.GraphQL.executeAsync(GraphQL.java:470) ~[graphql-java-10.0.jar!/:na]
at graphql.GraphQL.execute(GraphQL.java:401) ~[graphql-java-10.0.jar!/:na]
at graphql.GraphQL.execute(GraphQL.java:371) ~[graphql-java-10.0.jar!/:na]
Specifically, my query looks similarly like {payment(id: 152) {specificSymbol __typename}}
.
This query works without problem in version 9.3
using MaxQueryComplexityInstrumentation
.
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
Introspection | GraphQL Kotlin
Clients can use introspection to obtain information about all the supported queries as well as all the types exposed in the schema.
Read more >Index (graphql-java 230521-nf-execution API) - Javadoc.io
A factory method for creating asynchronous data fetchers so that when used with static imports allows more readable code such as:.
Read more >GraphQL Relay introspection query fails: Unknown field ...
When I try the exact same query on GraphIQL (the playground that the server offers me), there is no error, and the query...
Read more >How to GraphQL in Kotlin and Micronaut and create a single ...
GraphQL Java adds several scalar types and provides the ability to write custom scalars. The presence of the exclamation mark after type name...
Read more >Schema parser options - GraphQL Java Kickstart
contextClass : If you use a custom context object to execute your queries ... Allows a schema to be created even if not...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yikes… That seems bad… We will look ASAP
On Wed., 5 Sep. 2018, 04:44 vojtechmasa, notifications@github.com wrote:
Will there be a point release for this soon? We upgraded to 10.0 recently and would prefer to roll forward than backward.