Skip to content

Subscription deserialization error when not using Apollo protocol #252

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

Closed
WenSteven opened this issue May 20, 2020 · 1 comment · Fixed by #254
Closed

Subscription deserialization error when not using Apollo protocol #252

WenSteven opened this issue May 20, 2020 · 1 comment · Fixed by #254
Labels

Comments

@WenSteven
Copy link

Describe the bug
java.lang.IllegalArgumentException: 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 ('{ "query": "subscription CustomerImportSub { stockQuotes(stockCodes:[12]) {taskCount completedCount}}", "variables": {} }') at [Source: UNKNOWN; line: -1, column: -1] at com.fasterxml.jackson.databind.ObjectMapper._convert(ObjectMapper.java:4202) ~[jackson-databind-2.11.0.jar:2.11.0] at com.fasterxml.jackson.databind.ObjectMapper.convertValue(ObjectMapper.java:4133) ~[jackson-databind-2.11.0.jar:2.11.0] at graphql.kickstart.execution.subscriptions.GraphQLSubscriptionMapper.readGraphQLRequest(GraphQLSubscriptionMapper.java:16) ~[graphql-java-servlet-9.1.0.jar:na]

To Reproduce
this demo also get same error!!

I think GraphQLSubscriptionMapper.readGraphQLRequest should use ObjectMapper#readValue not convertValue

Screenshots

https://github.com/graphql-java-kickstart/graphql-spring-boot/tree/master/example-graphql-subscription

this demo has same error

@WenSteven WenSteven added the bug label May 20, 2020
@oliemansm oliemansm changed the title Cannot construct instance of "" no String-argument constructor/factory method to deserialize from String value Subscription deserialization error when not using Apollo protocol May 20, 2020
@oliemansm
Copy link
Member

GraphiQL uses the Apollo protocol, which is also the one I use in my projects, and in that case the subscription mapper is working fine as indicated. Judging by the code it could be that when you're not using Apollo protocol but it uses the FallbackSubscriptionConsumer you run into this problem. The subscription mapper should support both cases.

@oliemansm oliemansm linked a pull request May 20, 2020 that will close this issue
oliemansm added a commit that referenced this issue May 20, 2020
…ck-subscription-deserialization

Deserialize payload depending on type fix #252
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.

2 participants