Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

Latest commit

 

History

History
16 lines (10 loc) · 1.37 KB

4-invoking-another-lambda.md

File metadata and controls

16 lines (10 loc) · 1.37 KB

Invoking Another Lambda Function

Why

Since we separate Alexa Skill's Lambda function from our implementation of Web Server, when a new voice command was processed by the Alexa Lambda and the puzzle state was updated, the Web Server who's responding to the Arduino about the current state or the next move should be notified and updated as well.

To do this, we will need inter-invocation of two lambda functions which is as easy as a few lines of code shown below.

How

By using aws-sdk nodejs package, here is a great example from StackOverflow.

A concrete example in our code base is in slidingPuzzle/lambda/custom/stateHandlers.js where we update our "Web Server" with the latest puzzle state through invoking that lambda function whose action paramters is update, or namely ../prod/puzzle?action=update&toMove=true&startingPos=...:

1