question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Query for introspection field __typename throws an exception if MaxQueryComplexityInstrumentation is used

See original GitHub issue

If 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:closed
  • Created 5 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
bbakermancommented, Sep 6, 2018

Yikes… That seems bad… We will look ASAP

On Wed., 5 Sep. 2018, 04:44 vojtechmasa, notifications@github.com wrote:

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.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/graphql-java/graphql-java/issues/1200, or mute the thread https://github.com/notifications/unsubscribe-auth/ABlbSSfGBCfQV4BgTfCOHKX5k9xv44u-ks5uXsn6gaJpZM4WZiPr .

0reactions
alexgencocommented, Sep 19, 2018

Will there be a point release for this soon? We upgraded to 10.0 recently and would prefer to roll forward than backward.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found