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

GraphQL NullPointerException when running Quarkus project #17733

Closed
talbiislam96 opened this issue Jun 7, 2021 · 6 comments · Fixed by #17845
Closed

GraphQL NullPointerException when running Quarkus project #17733

talbiislam96 opened this issue Jun 7, 2021 · 6 comments · Fixed by #17845
Labels
Milestone

Comments

@talbiislam96
Copy link

talbiislam96 commented Jun 7, 2021

Trying to build an api using GraphQL and Quarkus . I get NullPointerException whenever I run
mvn compile quarkus:dev

This is the api :

  @Query
    public Map<MissionDto, List<CaseTimesheetDto>> getAllSheetsForUser(@Name("year") int year, @Name("week") int week){
        return timeSheetGraphQlService.getTimesheetUser(year,week,getCurrentUserId().toString());

    }

current behavior :

 2021-06-07 16:34:58,440 WARN  [io.qua.dep.ide.IdeProcessor] (build-11) Unable to determine running IDE processes
2021-06-07 16:35:02,425 ERROR [io.qua.dep.dev.IsolatedDevModeMain] (main) Failed to start quarkus: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
	[error]: Build step io.quarkus.smallrye.graphql.deployment.SmallRyeGraphQLProcessor#buildExecutionService threw an exception: java.lang.NullPointerException
	at io.smallrye.graphql.schema.creator.ReferenceCreator.getReference(ReferenceCreator.java:275)
	at io.smallrye.graphql.schema.creator.ReferenceCreator.collectParametrizedTypes(ReferenceCreator.java:356)
	at io.smallrye.graphql.schema.creator.ReferenceCreator.getReference(ReferenceCreator.java:310)
	at io.smallrye.graphql.schema.creator.ReferenceCreator.getReference(ReferenceCreator.java:245)
	at io.smallrye.graphql.schema.creator.ReferenceCreator.createReferenceForOperationField(ReferenceCreator.java:95)
	at io.smallrye.graphql.schema.creator.OperationCreator.createOperation(OperationCreator.java:70)
	at io.smallrye.graphql.schema.SchemaBuilder.addOperations(SchemaBuilder.java:229)
	at io.smallrye.graphql.schema.SchemaBuilder.generateSchema(SchemaBuilder.java:107)
	at io.smallrye.graphql.schema.SchemaBuilder.build(SchemaBuilder.java:80)
	at io.quarkus.smallrye.graphql.deployment.SmallRyeGraphQLProcessor.buildExecutionService(SmallRyeGraphQLProcessor.java:170)
	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)
	at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:920)
	at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2415)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1452)
	at java.base/java.lang.Thread.run(Thread.java:834)
	at org.jboss.threads.JBossThread.run(JBossThread.java:501)

I don't know what seems to be the problem here , I would appreciate a little help , thanks in advance.

@talbiislam96 talbiislam96 added the kind/bug Something isn't working label Jun 7, 2021
@quarkus-bot
Copy link

quarkus-bot bot commented Jun 7, 2021

/cc @jmartisk, @phillip-kruger

@phillip-kruger
Copy link
Member

Hi @talbiislam96 .

I think the problem is the Map. At the moment map is not supported (in graphQL). We have been discussing how we can support it in SmallRye, basically, we create a object that contain key-value pairs. You can do that yourself for now. see smallrye/smallrye-graphql#754

Also (just f.y.i) You can omit the @Name annotation in the method parameter, as the parameter name is the same as the annotation value. Typically name is only used when you want to change the name from the parameter.

Closing here as maps are not supported. If you want you can open a ticket in SmallRye GraphQL (or reopen the one mentioned above) and we can discuss a possible implementation.

@gsmet
Copy link
Member

gsmet commented Jun 7, 2021

I don't think we should close the issue. You can have things unsupported but you shouldn't throw a NPE but a proper error message. Can we make things better for the user?

@phillip-kruger
Copy link
Member

We can open a ticket in SmallRye for the NPE. I'll do that now.

@phillip-kruger
Copy link
Member

@talbiislam96
Copy link
Author

@phillip-kruger Thank you so much for your answer , I hope the issues gets fixed as soon as possible , as for now I will try and create an object with key-value pairs as you suggested.

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

Successfully merging a pull request may close this issue.

3 participants