Modifying the Config doesn't work.
I have followed the instructions and when I use your lambda.zip file it seems to work. But when I update the config to change the image sizes, it fails. I have used the npm install and ./bundle.sh to create the zip. I then tear down the CloudFormation and the Lambda and start again. It creates the new lambda correction but it doesn't work. When I look at the log file I get:
START RequestId: b1fd35d3-4391-11e7-9a6e-e345aeb705c6 Version: $LATEST
Unable to import module 'index': Error
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.
Can you show the me config you use? maybe the JSON is invalid?
The issue was actually with the nodes_module. For some reason when I follow the instructions and run the install npm, then bundle it, it creates a separate directory for each required bundle (async, gm, array-parallel, array-series, etc). Your script seems to require array-parallel, array-series, etc to be in the nodes_module directory inside the gm directory of the root nodes_module directory. When I move them there manually, the script works. Any idea why they need to be there? And why install puts them in the subfolders?
I guess that's related to the node version. Can you run those two commands to get the node and npm version:
npm -v
node -v
ALso, what Operating System are you using?
npm -v 3.10.9 node -v v6.9.2
I'm using a Mac.
Okay, that's similar to my setup.
Just to understand the problem correctly. Can you post the output of the following command tree -L 1 node_modules/ before you move directories (this should not work) and after (this should work).
First of all, thank you @michaelwittig for your example.
I had same issue. The lambda.zip file wasn't updated for years, but it worked and helped me to resolve the issue. I discovered that with my npm 3.10.10 doesn't get dependencies for gm module. There was no node_modules/gm/node_modules folder. After I run nvm install 0.10.36 && nvm use 0.10.36, I can use bundle.sh to package lambda.