graphql-spring-boot icon indicating copy to clipboard operation
graphql-spring-boot copied to clipboard

@connection not working after Spring Boot and graphql upgrade

Open clanie opened this issue 1 year ago • 1 comments

After upgrading to version 15 and Spring Boot 3.0.5 (from Spring Boot 2.7 and graphql-spring-boot-starter 11.0.0) our application fails to start, throwing this exception:

Caused by: graphql.schema.validation.InvalidSchemaException: invalid schema:
A definition for directive 'connection' could not be found
    at graphql.schema.GraphQLSchema$Builder.validateSchema(GraphQLSchema.java:935)
    at graphql.schema.GraphQLSchema$Builder.buildImpl(GraphQLSchema.java:929)
    at graphql.schema.GraphQLSchema$Builder.build(GraphQLSchema.java:894)
    at graphql.kickstart.tools.SchemaObjects.toSchema(SchemaObjects.kt:29)
    at graphql.kickstart.tools.SchemaParser.makeExecutableSchema(SchemaParser.kt:111)
    at graphql.kickstart.autoconfigure.tools.GraphQLJavaToolsAutoConfiguration.graphQLSchema(GraphQLJavaToolsAutoConfiguration.java:147)
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
    at java.base/java.lang.reflect.Method.invoke(Method.java:578)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:139)
    ... 124 common frames omitted

We have a lot of queries defined similar to this:

customers(orgId: UUID!, cursor: String, pageSize: Int, sort: String, filter: CustomerFilter): CustomerConnection @connection(for: "Customer")

and it obviously has something to do with the @connection directive in that, but I can't for the life of me figure out why it no longer understands that.

According to https://www.graphql-java-kickstart.com/tools/relay/ it should be handled by RelayConnectionFactory, which should be enabled by default.

clanie avatar Apr 05 '23 07:04 clanie