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

NoSuchMethodError when WebGraphQlResponse::transform #773

Closed
streambuf opened this issue Aug 16, 2023 · 1 comment
Closed

NoSuchMethodError when WebGraphQlResponse::transform #773

streambuf opened this issue Aug 16, 2023 · 1 comment
Labels
status: invalid An issue that we don't feel is valid

Comments

@streambuf
Copy link

streambuf commented Aug 16, 2023

Because of graphql-java/graphql-java#2240 I want to customize validation error response by using transform method.

I saw this example here https://docs.spring.io/spring-graphql/docs/current/reference/html/#overview 2.4.1. WebGraphQlInterceptor

@Component
public class GraphqlQLValidationErrorTransformer implements WebGraphQlInterceptor {
    @Override
    public Mono<WebGraphQlResponse> intercept(WebGraphQlRequest request, Chain chain) {
        return chain.next(request).map(response -> response.transform(builder -> {
            // do nothing
        }));
    }
}

but I'm getting:

java.lang.NoSuchMethodError: 'graphql.ExecutionResultImpl graphql.ExecutionResultImpl$Builder.build()'
	at org.springframework.graphql.support.DefaultExecutionGraphQlResponse$Builder.build(DefaultExecutionGraphQlResponse.java:213) ~[spring-graphql-1.1.3.jar:1.1.3]
	at org.springframework.graphql.server.WebGraphQlResponse.transform(WebGraphQlResponse.java:75) ~[spring-graphql-1.1.3.jar:1.1.3]
	at com.core.in.graphql.GraphqlQLValidationErrorTransformer.lambda$intercept$1(GraphqlQLValidationErrorTransformer.java:15) ~[main/:na]
+--- org.springframework.boot:spring-boot-starter-graphql -> 3.0.6
|    +--- org.springframework.boot:spring-boot-starter:3.0.6 (*)
|    +--- org.springframework.boot:spring-boot-starter-json:3.0.6 (*)
|    \--- org.springframework.graphql:spring-graphql:1.1.3
|         +--- com.graphql-java:graphql-java:19.3 -> 20.2

I don't understand why. I'm seeing build() method in ExecutionResultImpl.Builder() (graphql-java:20.2)

This code also works without error:

new ExecutionResultImpl.Builder().build();
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Aug 16, 2023
@rstoyanchev
Copy link
Contributor

spring-graphql 1.1.3 is itself compiled against graphql-java 19.3 and it's running into a binary incompatibility. In version 20, the ExecutionResultImpl builder was promoted to the interface level, see graphql-java/graphql-java@d0d06b7#diff-c75d032b33c66965d870f7828c65fc4aced1d70a5456711e15695c942c386991. Boot 3.1 and spring-graphql 1.2.x is built with GraphQL Java 20.

@rstoyanchev rstoyanchev closed this as not planned Won't fix, can't repro, duplicate, stale Sep 1, 2023
@rstoyanchev rstoyanchev added status: invalid An issue that we don't feel is valid and removed status: waiting-for-triage An issue we've not yet triaged labels Sep 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: invalid An issue that we don't feel is valid
Projects
None yet
Development

No branches or pull requests

3 participants