aws-lambda-image
aws-lambda-image copied to clipboard
Lambda fails to run
I've set the lambda to point to a specific bucket and resize the image 3 times. Everytime I upload an image to the monitored folder, I get the following error message:
Unable to import module 'index': Error
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.
My configuration is as follows (with bucket name replaced):
{ "bucket": "bucketnamehere", "resizes": [ { "size": 100, "directory": "p/w_100" }, { "size": 192, "directory": "p/w_192" }, { "size": 730, "directory": "p/w_730" } ] }
Also asked a co-worker to set up NodeJS from scratch and regenerate the lambda zip file, but gives the same error message.
I've tried to process with your configuration on Lambda on Node.js 0.10 / 4.3 runtime, and it succeed.
It seems to be able to resolve bundled module path, and make configtest
command result was green.
I want to know your settings:
- Process image's MimeType. (png or jpg)
- Using memory size of Lambda's setting
And, please rebuild this package at upstream master's branch sources.
make configtest also gives me green result.
- Images I tested was jpg
- Memory size is set to 1536MB
Strangely enough, another co-worker has no issues with the same config, but he's using an older build (https://github.com/ysugimoto/aws-lambda-image/commit/77e17e78f7d2d82c876fa7ac998ff883da640488)
I'll retest and let you know.
Seems like I'm on the latest build and still gives me the same error (0.10 and 4.3 runtime).
Can I provide you with any other information to help solve this issue?
It may be no loaded bootstrap module ( in this pakage, bootstrap module is index.js
).
Perhaps, It fails on build phase: make lambda
.
Check build archive, extract it, and do you find in index.js
at archived directory on top level?
Yep, index.js is there. make lambda also doesn't give me any error message.
I had problem on dependency library, and updated to 0.8.0. Please update package or re-install this, try it.
@ysugimoto I am also getting same issue with latest version
START RequestId: 8b97cd19-8af9-11e6-a8b1-07630d403ce7 Version: $LATEST
Unable to import module 'index': Error
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/var/task/index.js:10:24)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
END RequestId: 8b97cd19-8af9-11e6-a8b1-07630d403ce7
Here its my config file
{
"reduce": {
"directory": "reduced",
"quality": 90
},
"resizes": [
{
"size": 900,
"directory": "tn",
"quality": 90
}
]
}
Memory size is 1024mb.
Pls suggest.
Not a help for the issue above, but if your symptoms are similar make sure your handler in lamda is called index.handler
. I called mine after the function and it didn't work due to module name mismatch.