Amazon has made it extremely easy getting started developing an Alexa skill. They offer some very mature SDKS, an active development team, free hosting, and some pretty decent documentation.
The problem though, is that they made it really, really easy. Easy to make some development mistakes.
Today lets address the most serious, in my opinion.
If you read through the documentation and tutorials, it seems real simple.
- Create an Amazon Developer account.
- Login to the Developer Portal and create a new Alexa skill.
- Log into the AWS console and create a Lambda function using one of their samples.
- Tie the Lambda function to the Skill via the ARN.
- Request Certification.
- Success! You have a published skill.
Now you want to update your code, add some features, maybe fix a bug. Which Lambda ARN did you reference in your skill? If you followed the directions, its probably pointed to $latest. That means that if you update your function, it changes the code thats serving your, now in production, skill.
So what should be done?
All good developers version their code. You probably have already done it with the skill source code on your development system. AWS allows you to version the code running on your Lambda and you should be.
Each version locks in the source code at the time the version is created. You then have an ARN that points to that version, to that point in time if you will.
This is great, because you can point your production skill to the ARN representing a specific version, and then you can work on $latest without messing up a working production skill!
Wait, so every time you request new certification, you need to change the ARN in the Developer Portal to match a new version?
No. AWS offers updatable aliasing. You can create an alias and update it to point to a different version. So you could create a ‘Production’ alias and point your skill to that.
That sounds great, and in nearly every other scenario it would be. However…
Lets say you have gone through testing, and version 5 is working great. You decide this is the one you are going to submit for certification. You create a ‘production’ alias and point it to version 5. You take the ‘production’ arn, put that into your skill and submit for certification. It gets accepted.
Amazon does something really cool for you upon approval. They create a development skill from which you pull up new versions to be submitted for certification. It can have a different ARN than your production skill has.
Now you continue working and version 7 needs to be submitted. If you used the ‘production’ alias, what do you submit this next time? If you update the production alias to point to version 7, not only is it going to be used to try and pass certification, but your production skill now points to this new uncertified version.
For development or beta testing, an alias is useful. But you need to understand what you are doing.
Update: See Alexa Skills and AWS Lambda Aliasing
You will need to add the Alexa Skill trigger to each version individually. But don’t worry, the developer console will warn you if you forget.