Quick tip-Make sure you use Lambda Versions for your Alexa skills

Or to be more blunt, how not to break a live skill.

Tom Berwick
Alexa Skills Dev
3 min readNov 28, 2019

--

Photo by Sam Dan Truong on Unsplash

There are multiple ways to build a back-end to your Alexa app, you can use your own server or an Alexa hosted skill for example. But one of the most common, and easiest, ways is to use AWS lambda.

For starters you get a million requests free per month. But it also makes it simple to add Alexa triggers and skill ID verification and it’s integrated nicely with the Alexa developer console — you just need to plug in your lambdas ARN (Amazon Resource Name).

So off you go and create your lambda and attach it to your skill and everything’s rosey. But then you decide to update your skill with some new, complex feature. You can obviously test this as much as possible locally but at some point you will want to deploy your lambda.

Now the thing is, your lambdas ARN always points to an alias known as $LATEST by default. And $LATEST is (as I’m sure you can work out) the latest version of your code. So BOOM, you upload your code and find there’s a bug in it and suddenly your live skill isn’t working anymore either. The problem is that by default your original and new version of your Alexa skill are both pointing to the same version of you lambda.

To get around this, when it comes to submitting your skill for certification, you should create a new version or alias of your lambda code and configure your skill to point to the specific ARN of this version.

In typical AWS fashion this is actually really simple to do, from the top of the lambda console for your function, simply choose “actions” -> “publish new version”. Give it a version number and hit “publish”.

Once a version is created, you cannot change the code, however you must set-up the Alexa Skills Kit trigger again. The ARN for the new version will be displayed in the top right of the screen. So simply copy this and set it as your Alexa skills endpoint.

If you like to be a bit more descriptive with your versions you can create an alias to a specific version. So rather than having an ARN along the lines of:

arn:aws:lambda:us-east-1:1234567891011:function:MyFunction:1

you can have

arn:aws:lambda:us-east-1:1234567891011:function:MyFunction:Version1SkillLaunch

But similar to versions, you must configure the Alexa Skills Kit trigger again for the alias.

And that’s it. Now you can happily edit $LATEST again whilst working on your new version of your skill and when you’re ready to publish, create a new lambda version again and assign it to the new version of your skill.

This was a problem I originally encountered myself with a new skill of mine Emoji Quiz where I didn’t create a specific ARN version and needed to update. I realised I was impacting my existing users and had to “release” a new version that was simply an ARN update — and lose a few days productivity whilst it went through the review process.

So set yourself up correctly from the start and make sure you version your lambdas.

If you haven’t already please check out my Emoji Quiz skill above and let me know what you think and if you want to ask any questions about Alexa development or be notified of new posts, follow this publication and join my new Facebook group here.

Thanks for reading.

--

--

Tom Berwick
Alexa Skills Dev

Mobile App, game and full stack developer. Constantly trying to learn new things and dabble in growth hacking