index.js Implementation
The file index.js
that is found in the top-level directory of your unique ID is the main entry point of your lambda function. This file should contain the majority of your JavaScript logic.
Mandatory exports
The file must export in CommonJs format the function register
which registers the execution triggers that the lambda function is listening on.
Importing dependencies
The file may import additional .js
and .json
dependencies that must be found in the same directory as the file index.js
itself (or under a subdirectory next to it).
Importing must use the CommonJs require()
syntax.
NPM packages may also be imported, subject to being in the allowed list.
Async await
Asynchronous code can and should use the modern async await
syntax directly.
Complete example
The following example monitors an Aave borrowing position every 10 minutes and if the position is close to liquidation, closes it using a contract that was deployed in advance for this lambda.
Last updated