Node.js 8.10 End of Life — How to Migrate Your Node.js Alexa Skill Lambda to Node.js 10.x

Joe Muoio Nov 25, 2019
Share:
Tips & Tools Node.js CLI Tutorial
Blog_Header_Post_Img

Editor’s Note: This blog covers migrating your self-hosted Alexa skills from Node.js 8.10 to Node.js 10.X. For migrating Alexa-hosted skills from Node.js 8.10 to Node.js 10.Xx please see our "How to Migrate Alexa-Hosted Skills from Node.js 8.10 to Node.js 10.x" blog.


You might have received an email from AWS about the end of life (EOL) for Node.js 8.10 at the end of 2019. This means there will no longer be any support for bug fixes, security updates, or performance improvements by the Node.js community starting on December 31, 2019. By February 3, 2020, you will no longer be able to update your Node.js 8.10 Lambda functions. Although your code will continue to run past this date, you will not be able to add new features or fix bugs. Whether you’re using the Alexa Skills Kit Command-Line Interface (ASK CLI) or the AWS Management Console, upgrading to Node.js 10.x is simple. If you’re using Alexa-Hosted skills, remove any deprecated Node.js APIs before February, 2020 as these skills are at risk of breaking on re-deployment. Let’s look at the major changes in Node.js.

Should I Change Any Code?

Most of the changes in Node.js 10.x are minor, and shouldn’t break common Alexa skills. With that said, take a look at the changes in this version of Node.js and make sure your code isn’t using any end of life APIs. You can see the full list of new deprecations and notable changes on the Node.js blog. Previously deprecated APIs reaching end of life are:

  • Internal getters/setters from net.Server
  • Older experimental async_hooks APIs

Notable new additions for skill developers:

  • Type checking has been added. See util_types docs
  • Environment process variables (process.env) must now be strings
  • Continued additions of Error Codes so you do not have to check the error message string See this Medium blog for more details.

Any end of life APIs must be changed when you change your runtime. After you remove references to end of life APIs, test your code with Node.js 8.10 to ensure it is working the same way as before. Then, you are clear for upgrading your production Lambdas.

Next, let’s walk through how to upgrade.

How to Upgrade if you Use the AWS Management Console

If you use the AWS Management Console to manage your Lambda function, upgrading is simple. Just follow these steps:

  1. Log into your AWS Management Console and navigate to the Lambda console
  2. Select your Alexa skill.
  3. In the Function Code block, in the runtime dropdown, select Node.js 10.x

Console image

4. Save your Lambda

5. Test your skill

How to Upgrade if you’re Using the ASK CLI

To upgrade your skill created with the CLI:

  1. Update your CLI. You will need the most up to date version for this approach to work. Run “npm install -g ask-cli”
  2. Open the ask CLI config file which you will find in <alexa_project_root>/.ask/config
  3. Under each of your “Lambda” objects, change the runtime from “nodejs8.10” to “nodejs10.x”
  4. In the CLI, run “ask deploy”
  5. Test your skill. If you open the AWS Lambda console, you will see you are now using version 10.x

Conclusion

If you encounter any unexpected or interesting problems in your upgrade, share it with me on Twitter @JoeMoCode! Happy upgrading!