alexa / alexa-skills-kit-sdk-for-java

The Alexa Skills Kit SDK for Java helps you get a skill up and running quickly, letting you focus on skill logic instead of boilerplate code.
http://developer.amazon.com/ask
Apache License 2.0
815 stars 746 forks source link

Jackson cannot deserialze errors #266

Closed fdw closed 3 years ago

fdw commented 4 years ago

I'm submitting a...

[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report  
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Other... Please describe:

Expected Behavior

Even if I run into an error, it can be properly deserialzed.

Current Behavior

If I run into an error, Jackson also dies on me with these erros:

com.amazon.ask.model.services.SerializerException: Deserialization error
    at com.amazon.ask.model.services.util.JacksonSerializer.deserialize(JacksonSerializer.java:71) ~[ask-sdk-model-runtime-1.0.2.jar:na]
    at com.amazon.ask.model.services.BaseServiceClient.executeRequest(BaseServiceClient.java:146) ~[ask-sdk-model-runtime-1.0.2.jar:na]
<snip>
Caused by: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of `com.amazon.ask.smapi.model.v1.Error` (no Creators, like default construct, exist): cannot deserialize from Object value (no delegate- or property-based Creator)
 at [Source: (String)"{"message":"We are experiencing heavy traffic at the moment. Please try again later."}"; line: 1, column: 2]
    at com.fasterxml.jackson.databind.exc.InvalidDefinitionException.from(InvalidDefinitionException.java:67) ~[jackson-databind-2.10.4.jar:2.10.4]

Steps to Reproduce (for bugs)

Call a method against the SMAPI that will return an error

Possible Solution

Provide a deserializer for Error

Context

I would like to use the API, but it I run into an error, I cannot deal with it.

Your Environment

Java Info

breedloj commented 4 years ago

Hey, thanks for reaching out and reporting this. Apologies for the lag time in getting back to you. I just released a patch version of the SMAPI SDK (1.6.1) that should address this issue. Basically the @JsonCreator annotation that Jackson needs to latch on to in order to materialize the Error class was missing. Please let me know if you continue to have issues with this following the upgrade.

fdw commented 4 years ago

Thanks for getting back on this!

I just tried it, but it still doesn't work. It's a different error, though: Caused by: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Builder class com.amazon.ask.smapi.model.v1.Error$Builder does not have build method (name: 'build')

breedloj commented 4 years ago

Gah! I see that. I just released a patch version (1.6.2) that should address this. Apologies for the churn.

fdw commented 4 years ago

Thanks, that seems to have done it :)