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

variables passed to the ExecutionInput cannot be null #39

Closed
alediaferia opened this issue Jul 22, 2019 · 3 comments
Closed

variables passed to the ExecutionInput cannot be null #39

alediaferia opened this issue Jul 22, 2019 · 3 comments

Comments

@alediaferia
Copy link

alediaferia commented Jul 22, 2019

When the variables parameter is not being passed as part of the request, graphql-java throws the following exception. This, in particular, is a nightly version of graphql-java which makes the issue explicit (graphql-java/graphql-java#1596). Earlier versions of graphql-java (from 11 on) fail with more obscure errors.

Would it make sense to ensure the propagated variables instance is never null and rather an empty map?

graphql.AssertException: variables map can't be null
	at graphql.Assert.assertNotNull(Assert.java:15)
	at graphql.ExecutionInput$Builder.variables(ExecutionInput.java:215)
	at io.leangen.graphql.spqr.spring.web.GraphQLExecutor.buildInput(GraphQLExecutor.java:20)
	at io.leangen.graphql.spqr.spring.web.servlet.DefaultGraphQLExecutor.execute(DefaultGraphQLExecutor.java:23)
	at io.leangen.graphql.spqr.spring.web.servlet.DefaultGraphQLExecutor.execute(DefaultGraphQLExecutor.java:11)
	at io.leangen.graphql.spqr.spring.web.GraphQLController.executeJsonPost(GraphQLController.java:42)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)

The above issue, in particular, is triggered simply loading a GraphiQL page which attempts an introspection query that doesn't include a variables field in the request.

@kaqqao
Copy link
Member

kaqqao commented Aug 12, 2019

Next release of the starter where this should work correctly is due this week.
But, as a general rule, do not expect you can change the version of graphql-java and expect things to work. Every release contains breaking changes.

@iguissouma
Copy link

iguissouma commented Oct 23, 2019

Using latest version 0.5.0-Snapshot with apollo-client on GraphQlController requestParams.getVariables() is not null it's an empty map so variables is not initialized with requestBody.getVariables()

2019-10-23_15h55_47

requestBody.getVariables() contains my variables

@kaqqao
Copy link
Member

kaqqao commented Feb 8, 2021

Fixed by #52

@kaqqao kaqqao closed this as completed Feb 8, 2021
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