AlexaDev Tuesday: Three Quick Alexa Skill Debug Tips

I’ve been laboring for about four consecutive weekends over two new skills, both written specifically to take advantage of the new Echo Show display and neither of which has any Amazon template skill to build from, so it’s no surprise I’m up to my armpits in test and debug. Today I’ll make my misery your gain by sharing a few Alexa skill debug tips that apply to all Alexa skill dev, not just Echo Show stuff.


Came To Read The Comments


1. Get creative with the console log.
When you’re the dev, there’s no need or excuse for cryptic error messages: write your own, more meaningful comments to the console log.

If you’re trying to track down a bug, go crazy with the comments you send to the console log. Send a confirmation comment to the log after every line of code in the questionable section executes, e.g., “line 247 aryFoo shuffled”, “line 1068 var selectedIndex value calcs to ” + selectedIndex, etc.

When your code runs you’ll be able to much more quickly identify the precise line where it’s failing, and also rule out everything that’s working properly. Remember: the comments you send to the console are only intended for YOU, so there’s no need to stand on ceremony with formal naming conventions and references to process id’s. Plain English is fine, and faster for your tired eyes and mind to grasp during long hours of test and debug.


2. Deciphering the mysterious, “I’m sorry, there was a problem with the requested skill’s response,” message.
It may make you angry to hear this, especially if you’ve spent hours going down the rabbit hole of your request – response logic trying to track down the bug, but this is just a generic error message that means there’s some kind of syntax, data, reference or logic error in your skill. It doesn’t necessarily have anything to do with the request – response code you’ve written, it could just as easily be a problem with the formatting or data type of a message you’re trying to send as speech output (forget to stringify an ordinal, did we?).

When you hear this error message, hit the console log hard to zoom in on the problem quickly.


3. During test and debug, the Alexa app is your friend.
Check the feedback being sent to the app for an at-a-glance picture of what your skill is doing, or trying to do and failing at. Of course the console log is going to give the deep dive, but when dealing with portions of the code that dictate or touch on user experience especially, the Alexa app view offers a different type of insight.

Even when there’s not a specific bug I’m chasing, I find it very helpful to make checking the Alexa app a regular part of my development process once I’ve got a functional skill to test. I don’t know about you, but when I’m wading through the console logs I get to feeling a little like Neo, seeing all the code instead of the Matrix it renders. It’s easy to forget that eventually, an end user is going to have to interact with my skill. Looking at what’s happening in the Alexa app instantly puts me back in the end user’s shoes and I never fail to find some detail or other I’ve overlooked or could improve in the app Card, or in the written messages I’m sending to the app.