As my title explains I am getting the following error:
{
\"errorMessage\": \"Cannot find module \'index\'\",
\"errorType\": \"Error\",
\"stackTrace\": [
I had the same problem sometime ago - I reformatted the code.
function lambdafunc1(event, context) {
...
...
...
}
exports.handler = lambdafunc1
If this was unclear for anyone else, here are the steps:
Step 1 Navigate to the folder of your project, and open that folder so that you are inside the folder:
Step 2 Select all of the images you want to upload into to Lambda:
Step 3 Right-click and compress the files you have selected:
This will give you a .zip file, which is the file you need to upload to Lambda:
There are a lot of ways to automate this, but this is the manual procedure.
make sure in your handler following code added
exports.handler = (event, context, callback) => {
...
}
The problem occurs when the handler cannot be located in the zip at first level. So anytime you see such error make sure that the file is at the first level in the exploded folder.
To fix this zip the files and not the folder that has the files.
Try zipping and uploading the contents of the folder lambda-create-timelapse. Not the folder itself.
Correct Lambda
function declaration can look like this:
var func = function(event, context) {
...
};
exports.handler = func;
You may have other syntax errors that prevent the index.js
file from being properly ran. Try running your code locally using another file and using the index.js
as your own module.