Skip to content
This repository was archived by the owner on Dec 19, 2023. It is now read-only.

Subscription #366

Closed
BaptisteMeynier opened this issue Mar 14, 2020 · 5 comments
Closed

Subscription #366

BaptisteMeynier opened this issue Mar 14, 2020 · 5 comments

Comments

@BaptisteMeynier
Copy link

BaptisteMeynier commented Mar 14, 2020

Hello,
I'm trying to use Subscription feature. I use a jquery client, I manage to call the server but I get the following error:

Caused by: com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance of `graphql.kickstart.execution.GraphQLRequest` (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value.

The request is formated like this:

{
"query":"subscription LastFamilySubscription { \n    lastFamily \\{       id        name      \\}\\}",
"variables":{}
}

I suppose that I forgot to provide a setting like an ObjectMapper.

When I use the dependency bellow, it's work well and I manage to get the stream

<dependency>
   <groupId>com.graphql-java</groupId>
   <artifactId>graphql-java-tools</artifactId>
   <version>5.2.4</version>
</dependency>

My project is host on https://github.com/BaptisteMeynier/Graphql-Subscription/blob/master/src/main/java/com/meynier/spring/graphql/graphql/FishSubscriptionResolver.java

Thx a lot

Regards

@BaptisteMeynier
Copy link
Author

It's work when I downgrade version 6.0.1 to 5.11.1 and include

        <dependency>
            <groupId>com.graphql-java-kickstart</groupId>
            <artifactId>graphql-java-kickstart</artifactId>
            <version>9.0.1</version>
        </dependency>

@oliemansm
Copy link
Member

You should only add the spring-boot-starter to the project, it'll pull in the correct version of graphql-java-tools and graphql-java-servlet. When you defined them all yourself you're going to run into compatibility issues like the ones you encountered here.

We just released version 7.0.0 of this starter which pulls in these dependencies, so it should be fixed using that. If not then feel free to reopen the issue.

@simoneggler
Copy link

i'm running into the same issue with the 7.0.0 starter. how can i fix this?

@kingzoler
Copy link

same issue with 7.0.1

@oliemansm
Copy link
Member

After further investigation in the end this appears to depend on which subscription protocol is used. When you use Apollo (like GraphiQL and Altair do) it works fine and that's why I wasn't able to reproduce it. If you don't use Apollo but it needs to use the fallback protocol it will cause an issue. Please see graphql-java-kickstart/graphql-java-servlet#252 to track this issue further, since the solution will be in that project instead.

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

No branches or pull requests

4 participants