question

Cam Collins avatar image
Cam Collins asked

There was a problem communicating with the requested application

Hello, We are trying to debug our first skill and get the following verbal response from Alexa: "there was a problem communicating with the requested application" We verified that the target URL was in fact successfully "crawled" by the service, so there is not an issue with it being blocked. In my Echo app, it says: "Unexpected Communication Issue" MySkill Request Identifier: amz1.echo.laksdjg;lksajg;aslkgdjasd;lkgjad;glkjds; (blah blah blah) ... What I am looking for is a more specific error output. Is there a place to better understand what "problem" might mean? We don't show any errors occurring on our end. Thanks!
alexa skills kitdebugging
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Cam Collins avatar image
Cam Collins answered
We made some progress. Now it says "There was a problem with the requested application response."
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Cam Collins avatar image
Cam Collins answered
One step forward, two back. My Echo app provided a Content Length header error. So we added a Content Length header using function strlen to get an accurate count. Now we are back to the Unexpected Communication Issue.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Cam Collins avatar image
Cam Collins answered
SUCCESS! We found out there was a comment causing the issue. Yes, a comment. // JSON Document This line was in the top of our code and Alexa was not pleased by it. As soon as we deleted it, it started working!
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

April L. Hamilton avatar image
April L. Hamilton answered
I've found Alexa throws "I'm having trouble accessing your [name] app right now" as an all-purpose error when there's an error of any kind in my code. When I hear [i]that[/i] during a test session, I go back to my script to start looking for missing brackets, braces and semicolons. Sounds like "There was a problem communicating with the requested application" may be a similarly generic error message for miscellaneous code errors.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Greg Laabs avatar image
Greg Laabs answered
She says that when your endpoint failed to return a proper JSON object. You should structure your app such that it will ALWAYS provide an Alexa response even if an unexpected error occurs. Try wrapping your main method in a try/catch, and then you can log the unhandled exception in the case of an issue, and have Alexa give a more customized error response. Also, you'd likely avoid a lot of these issues if you developed with an editor that provided linting, or even better full on code inspection. If you're using Javascript, get JSHint setup in your editor. I personally use WebStorm for javascript development and its code inspection warnings are a godsend for catching silly issues before I end up needing to debug them. :)
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

jjaquinta avatar image
jjaquinta answered
You can always test with EchoSim. It's easier to get a coherent response from it since it doesn't have to report to the user. You can also set up regression tests which make it a lot less tedious to reproduce problems! https://github.com/jjaquinta/EchoSim
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Ross@Amazon avatar image
Ross@Amazon answered
Thank you for commenting on this error and your solution. We appreciate your participation and interest in Amazon's Alexa Skills Kit developer program.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.