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

Deserialisation exception from GraphQLResponse.from #1035

Open
janosmeszaros opened this issue Jan 15, 2024 · 0 comments
Open

Deserialisation exception from GraphQLResponse.from #1035

janosmeszaros opened this issue Jan 15, 2024 · 0 comments

Comments

@janosmeszaros
Copy link

janosmeszaros commented Jan 15, 2024

Hi,

we are using http4k with the GraphQL-java library and experience some malfunction while transforming ExecutionResult to GraphQLResponse using GraphQLResponse.from. The exception reads as this:

Cannot construct instance of `java.util.LinkedHashMap` (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('graphql.execution.NonNullableValueCoercedAsNullException:...

Looking into the issue, it seems that ExecutionResult can be populated by the GraphQL-Java lib with errors that both implement GraphQLError and extend GraphQLException (one example is the above-mentioned NonNullableValueCoercedAsNullException). This is causing the exception because in the GraphQLResponse.from method there is a serialization deserialization cycle using ConfigurableJackson which by default seralize Throwables as String (link) and that String cannot be deserialized back to a Map.

I found some workarounds to prevent this issue (configuring a custom JSON marshaller; not using GraphQLResponse.from; or using ExecutionResult::toSpecification based on graphql-java's documentation) but maybe there are some better solutions for it you are aware of or a bugfix is necessary.

Versions:
http4k: 4.33.1.0
graphql-java: 19.2

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

No branches or pull requests

1 participant