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
818 stars 748 forks source link

Dynamic Image URL not supported in APL #202

Closed jvence closed 5 years ago

jvence commented 5 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:

Trying to show dynamic images within an APL template with RenderDocumentDirective fails when using a dynamic image url such as https://www.example.com/api/img?url=https%253A%252F%252Fb.zmtcdn.com%252Fdata%252Fres_imagery%252F6102866_RESTAURANT_fcfffe4b20e1061cbe93be5851dce309.jpg&width=1024&height=600

Expected Behavior

Should render image and content on device screen. Changing the image url to a static url works well.

Current Behavior

The entire request fails and the skill is aborted

Your Environment

com.amazon.alexa - ask-sdk - 2.17.1

Java Info

breedloj commented 5 years ago

Hey, thanks for reaching out. Do you mind providing a few more details to help us dig in to the issue? The code where you're generating the failing response would be helpful, as well as an example "good" URL, and the full exception you're getting when sending back the response. I'm wondering if there could be some URL encoding issue at play given the format of the URL you provided.

jvence commented 5 years ago

There's are no errors logged in the console (even though logging is enabled). Alexa just says "There was a problem with the requested skill's response"

String img = HPController.IMAGE_PROCESSOR_URL + URLEncoder.encode(p.getImgUrl(), "UTF-8").replaceAll("%", "%25") + "&width=1024&height=600";

breedloj commented 5 years ago

Yeah, this is definitely an issue related to URL encoding. I am unable to get URL encoded image URLs to render in my APL test skill as well. If you don't encode the embedded URL I am guessing it fails since it is then treating those path components and parameters as part of the 'outer' URL? If that is the case you will unfortunately need to use static URLs for the time being at least. I will pass this feedback along to the APL service team.

breedloj commented 5 years ago

Closing this due to inactivity. Feel free to reopen if you are still having issues.