Amazon Alexa Skill Development | Hints for rookies (like me)

First of all:
HUGE THANKS TO
https://github.com/jeffblankenburg for https://github.com/alexa/skill-sample-nodejs-audio-player
AND
https://github.com/jkelvie for https://github.com/bespoken/streamer

I did all the way these great dudes had recommended but i run in some problems i will describe now:

1. Creating an AWS Lambda function i could not select “Alexa Skills Kit” as the “Trigger” cs it does not appear in drop down list.
SOLUTION:
Change your region in the upper right corner either to US East (N. Virginia) or to EU (Ireland)

At this Point https://github.com/alexa/skill-sample-nodejs-audio-player works properly.
Now i have had tried to use bespoken bst as a development proxy like in https://github.com/bespoken/streamer and got some errors:
Running bst was easy but executing code produces some error messages:

1. Problem

get error: {
"message": "Missing region in config",
"code": "ConfigError",
"time": "2017-03-29T12:16:07.901Z"
}

SOLUTION:
Open your DynamoAttributesHelper.js and replace

var aws = require('aws-sdk');

with

var aws = require('aws-sdk');
aws.config.update({
region: 'eu-west-1'
});

2. Problem

get error: {
"message": "Missing credentials in config",
"code": "CredentialsError",
"time": "2017-03-29T12:26:16.389Z",
"retryable": true,
"originalError": {
"message": "Could not load credentials from any providers",
"code": "CredentialsError",
"time": "2017-03-29T12:26:16.389Z",
"retryable": true,
"originalError": {
"message": "Connection timed out after 1000ms",
"code": "TimeoutError",
"time": "2017-03-29T12:26:16.389Z",
"retryable": true
}
}
}

SOLUTION:
The user you are running bst from needs to authenticate against the aws platform. bst reads these credentials from a file .aws/credentials in your users home directory or from your shells environment variables.
Go to your home directory, create .aws/credentials and add the following lines:

[default]
aws_access_key_id=youraccesskeyid
aws_secret_access_key=yoursecretaccesskey
region=eu-west-1

Then login into AWS IAM and create a group like ‘my_developer_group’ and add the following policies ‘AmazonDynamoDBFullAccess’ and ‘CloudWatchLogsFullAccess’.
Create a user like my_developer_user and attach it to the this group.
Copy the Access key ID (NOT the username) and the Secret access key into your credentials file.
In case you get the error message

get error: {
"message": "The security token included in the request is invalid.",
"code": "UnrecognizedClientException",
"time": "2017-03-29T12:40:33.082Z",
"requestId": "C849P4UFVNADK0UTR1ABOTEUL3VV4KQNSOXXXXVJF66Q9ASUAAJG",
"statusCode": 400,
"retryable": false,
"retryDelay": 47.018669552205715
}

your key id or secret are mistyped or you have had chosen the wrong policies for your my_developer_group in aws IAM.

HINT:
Adding the ‘region’ entry to your credentials file at the moment (2017-MAR-29) does not solve the above region problem.

3. Problem

Don’t know howto trigger the skill into START_MODE

SOLUTION:

Goto https://eu-west-1.console.aws.amazon.com/dynamodb/home?region=eu-west-1#tables: – enter your table and delete the data objects you want…

4. Problem

SOLUTION:

Insert some console.log lines printing DEBUG into your code.

Run bst this way:

bst proxy lambda js/index.js --verbose 2>&1 | (while read LINE; do echo "$LINE" | grep -w -e DEBUG -e speak -e index; done)

 

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.