lambda icon indicating copy to clipboard operation
lambda copied to clipboard

Modifying the Config doesn't work.

Open MarquisT opened this issue 8 years ago • 6 comments

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. (/var/task/node_modules/gm/lib/convenience/morph.js:7:16) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) END RequestId: b1fd35d3-4391-11e7-9a6e-e345aeb705c6

MarquisT avatar May 28 '17 10:05 MarquisT

Can you show the me config you use? maybe the JSON is invalid?

michaelwittig avatar May 29 '17 11:05 michaelwittig

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?

MarquisT avatar May 30 '17 11:05 MarquisT

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?

michaelwittig avatar May 30 '17 11:05 michaelwittig

npm -v 3.10.9 node -v v6.9.2

I'm using a Mac.

MarquisT avatar May 30 '17 12:05 MarquisT

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).

michaelwittig avatar May 31 '17 14:05 michaelwittig

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.

Bessonov avatar Jul 10 '17 12:07 Bessonov