Allow Alexa to run your locally hosted skill

We never had easy way to run Alexa skills locally and unit test was one of the ways to actually test them.

Looking at the documentation for Google Home Actions, I discovered an amazing tool: ngrok!

What it does? Exposes your localhost publicly through an HTTP tunnel

This way, you can simply run your local NodeJS server.

$ npm install
$ npm start
server listening on localhost:3000

Then, in another terminal (once your ngrok executable is in your $PATH)

ngrok http -bind-tls=true -host-header=rewrite 3000

Copy the https URL displayed by ngrok and paste it as the host for your Alexa skill configuration.

At first, it did not work because the SSL certificate is not detected as valid and it lead to a signature chain verification failure.

BUT, changing the Alexa skill SSL Certificate configuration to

My development endpoint is a sub-domain of a domain that has a wildcard certificate from a certificate authority

allowed the skill to be accessible!

And voilà! Enjoy developing your skill locally without having to redeploy all the time.