AWS Lambda Function is returning "Cannot find module 'index'" yet the handler in the config is set to index
Try zipping and uploading the contents of the folder lambda-create-timelapse. Not the folder itself.
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.
I ran into this problem a few times myself, and this indeed has to do with zipping the folder instead of just the contents like you're supposed to.
For those working from the terminal...
While INSIDE of the directory where the .js files are sitting, run the following:
zip -r ../zipname.zip *
The *
is instructing the client to zip all the contents within this folder, ../zipname.zip
is telling it to name the file zipname.zip
and place it right outside of this current directory.