neo4j-graphql-java icon indicating copy to clipboard operation
neo4j-graphql-java copied to clipboard

kotlin.KotlinNullPointerException upon calling graphql.schema() as soon as I use a UNION type

Open flq opened this issue 5 years ago • 4 comments

I suspect this can be well reproduced by providing the schema I tried:

union Thing = ThingA | ThingB

type User {
  id: ID!
  commentsOn: [Thing!] @relation(name: "COMMENTED")
}

type ThingA {
  id: ID!
}

type ThingB {
  id: ID!
}

The schema is accepted wth a call to graphql.idl but once I call graphql.schema I get

Neo.ClientError.Procedure.ProcedureCallFailed: 
Failed to invoke procedure `graphql.schema`: 
Caused by: kotlin.KotlinNullPointerException

I haven't tested whether other operations work but would open a different issue in that case, as this one is only related to graphql.schema()

flq avatar Jul 29 '19 20:07 flq

OK, the call from GraphiQL gives a bit more context:

kotlin.KotlinNullPointerException
	at org.neo4j.graphql.GraphQLSchemaBuilder.newReferenceField(GraphQLSchemaBuilder.kt:266)
	at org.neo4j.graphql.GraphQLSchemaBuilder.addRelationships(GraphQLSchemaBuilder.kt:232)
	at org.neo4j.graphql.GraphQLSchemaBuilder.toGraphQLObjectType(GraphQLSchemaBuilder.kt:184)
	at org.neo4j.graphql.GraphQLSchemaBuilder.graphQlTypes(GraphQLSchemaBuilder.kt:682)
	at org.neo4j.graphql.GraphQLSchemaBuilder.buildSchema(GraphQLSchemaBuilder.kt:370)
	at org.neo4j.graphql.GraphQLSchemaBuilder$Companion.buildSchema(GraphQLSchemaBuilder.kt:333)
	at org.neo4j.graphql.GraphSchema.getGraphQL(GraphSchema.kt:23)

and it is now clear that this problem inhibits performing mutations as this apparently calls into getSchema as well.

flq avatar Jul 29 '19 21:07 flq

Thanks a lot also for the example.

I don't think we added support for unions yet, we plan to do it in https://github.com/neo4j-graphql/neo4j-graphql-java and then it will be available in the plugin too.

Still needs some thinking.

/cc @conker84

jexp avatar Jul 30 '19 09:07 jexp

Even without unions i am getting the same issue while creating more than one schemas. Please help me with this.

AnudeepKonaboina avatar Mar 22 '20 16:03 AnudeepKonaboina

when i executed this i did not get any error

call graphql.idl('type Studentdetails{ id :ID name:String age:Int }')

Then i created another schema

call graphql.idl('type Collegedetails{ id :ID name:String location:Sring students:[Studentdetails] @relation(name: "STUDYING_IN" ,direction :"IN") }')

Then when i executed

call graphql.schema()

i am getting Neo.ClientError.Procedure.ProcedureCallFailed Failed to invoke procedure graphql.schema: Caused by: kotlin.KotlinNullPointerException

Also when i refresh schema in insomnia i am getting 500 error .

Any solution to this please.

AnudeepKonaboina avatar Mar 22 '20 16:03 AnudeepKonaboina