AWS: Basics April 2018

I need to implement Skill synonyms. This is simple on the Skill/Client side – you just alter the json. However on the Lambda function side, you have to have implement logic to handle that.

Before I dive into that, I felt I needed a refresher of Lambda functions and how they sit in AWS, and how you test them (UI based to start). The 2 pictures try to convey where I got. Note that I am now executing in the London region – there was a warning previously that Skills only worked in 2 regions, neither of them London… so we’ll see if that works when I return to the Skill part. Secondly I am now giving Node.js 8.10 a try. I don’t yet know if that will make a mess of my Lambda-tester tests (see posts back in September I think).

For now, 2 pictures which try to convey where I got.


Alexa Skills: project structure

I couldn’t find anything mandating project structure. So I have taken the “speechAssets, src” pattern that you see (mostly) on the Amazon Alexa github repo, and adapted for my own wants:

For example…


Node.js: The [assert] package

I was tempted to write something about Assert with examples… but no point, as this person/persons has/have done a way better job than I would/could (Ed: enough).

And, in fact, this is part of a very generous GitBook:

[Later…] in fact I gave the book credit for giving more comprehensive coverage of Node.js that I assumed on first glance. This is the sum total of the book’s coverage:

Regardless, thanks to Nelson/Nelsonic for at least giving us this.


AWS Lambda/Node: starting unit testing

After some evenings of googling [AWS Lambda/Node/unit test framework] and playing with the results, I think I am pretty much up and running thanks to this person or persons…

and their excellent lambda-tester framework here and here.

For me, they have really abstracted things away well, and left very few moving parts behind to trip you up.  Thanks! 🙂

Important points:

  • Node in AWS Lambda works on a latest version of 6.10.* (I’m using 6.10.3, on Windows, FWIW). There are 2 other (earlier) supported versions – I’d stick with 6.10.
  • Sucking eggs: unless you are already clued up on AWS Lambda and Node (I’m using it for Alexa Skills, and I am a noob at this), do the Simplest Thing Possible to start with. On the Amazon side, I suggest that means the HelloWorld blueprint below. Then play with the first callback argument being null (success), and not null (failure), and see it come through when you run mocha. Point being ref Mocha: I think the lambda-tester help is pretty comprehensive for getting just enough knowledge on these supporting packages. Ping me if you want some help on this. I’m not many steps ahead of you, believe me :-). Of course, Hello World gives you nothing useful of itself. But this exercise is all about seeing the round trip working from a test to a function under test, both for a success, and for a failure.

Node: basic testing


AWS Lambda testing: dump of notes so far

Lessons: node 6.10.3. Don’t try the current version – it won’t work.
In my js/noob world, Lambda-tester is looking the simplest way so far to test AWS Lambdas. I’m not quite there yet, but will return to this very soon.

  Id CommandLine
 -- -----------
 1 node -v
 2 npm -v
 3 function prompt(){}
 6 pwd
 7 cd C:\Github\Alexa\MagContact\src\PackageSet\test
 8 pwd
 9 ls
 10 mocha
 11 cd ..
 12 pwd
 13 mocha
 15 npm install lambda-tester --save-dev
 16 npm install nonsense --save-dev
 17 npm install nonsensex --save-dev
 18 npm install lambda-tester --save-dev
 19 ls
 20 mocha
 21 npm install mocha -g
 23 mocha
 24 Get-History


Windows 32-bit Installer:
Windows 64-bit Installer:
Windows 32-bit Binary:
Windows 64-bit Binary: