7 Reasons why Alexa Skill may not work [NodeJS SDK]

7 April 2018

Alexa SDK isn't that new, I think it's available since 2015. Yet, there isn't much support, isn't enough StackOverflow, and certainly isn't enough YouTube videos. So it can be tricky to debug where the app went wrong between Amazon dev portal, Alexa skill set-up, and AWS Lambda set-up and function. So this is what went wrong in my 'hello world' skill, that, hopefully, may help someone to debug quicker.

1. Select the right region

Only US East (N. Virginia) and EU West (Ireland) can support Alexa Voice Services. I, somehow, ended up in Oregon at first. That did not work well for me when I was trying to setup Default Region (Endpoint section) in my Alexa Skill app on my Amazon dev portal.

region.PNG

2. Choose the right language settings

The language settings affect who uses your app and whether it will play on your own device. Make sure your skill has the same language as your device, even the dialects, i .e. US, UK, etc.

alexa-language.PNG

When publishing/launching your skills, do choose the languages you want to support as well as regions, i.e. countries who can use them. Read more on that here.

3. AWS Lambda Execution Role

This MUST be lambda_basic_execution.

execution_role.PNG

4. Alexa Skills kit ID first

After you activate 'Alexa Skills Kit' as a trigger on your AWS Lambda function, insert the Alexa Skill ID first, and only THEN configure your arn:aws endpoint in your Alexa skill.

lambda_id.PNG

5. node_modules have to be in your zip folder

Ther are no npm install commands for Alexa skills as far as I'm aware. So when you'll be zipping your skill files, include your node_modules there as well.

NOTE: index.js should be in the root.

6. APP_ID is appId now

When writing your exports.handler function, you'll need to set your appId there. Forums say it's done with APP_ID:

const Alexa = require("alexa-sdk"); exports.handler = function (event, context, callback) { const alexa = Alexa.handler(event, context); // Right here alexa.APP_ID = "amzn1.ask.skill.sample-skill-id"; alexa.registerHandlers(handlers); alexa.execute(); };

This is wrong. This is out of date. Use appId instead:

const Alexa = require("alexa-sdk"); exports.handler = function (event, context, callback) { const alexa = Alexa.handler(event, context); // Do this instead alexa.appId = "amzn1.ask.skill.sample-skill-id"; alexa.registerHandlers(handlers); alexa.execute(); };

7. Testing in the browser doesn't work

I don't know why. Just doesn't. Might be a bug. Might be me (more likely). I just use Echo dot, AWS Lambda Logs, and Amazon Alexa Andoird app for some error printing.

Hope this helps. Feel free to comment what went wrong with your skill dev process, or share a link to your blog. :)

©2024 Rail Yard Works LTD is registered in England and Wales, no. 12126621.