New to AWS and found it quite straightforward so far but really getting stuck packaging a lambda function.
I'm using node-lambda to try and run the function but keep getting the following error on node-lambda run:
/usr/local/lib/node_modules/node-lambda/lib/main.js:93
handler(event, context, callback);
^
TypeError: handler is not a function
at Lambda._runHandler (/usr/local/lib/node_modules/node-lambda/lib/main.js:93:7)
at Lambda.run (/usr/local/lib/node_modules/node-lambda/lib/main.js:49:8)
at Command.<anonymous> (/usr/local/lib/node_modules/node-lambda/bin/node-lambda:89:12)
at Command.listener (/usr/local/lib/node_modules/node-lambda/node_modules/mander/index.js:301:8)
New to AWS and found it quite straightforward so far but really getting stuck packaging a lambda function.
I'm using node-lambda to try and run the function but keep getting the following error on node-lambda run:
/usr/local/lib/node_modules/node-lambda/lib/main.js:93
handler(event, context, callback);
^
TypeError: handler is not a function
at Lambda._runHandler (/usr/local/lib/node_modules/node-lambda/lib/main.js:93:7)
at Lambda.run (/usr/local/lib/node_modules/node-lambda/lib/main.js:49:8)
at Command.<anonymous> (/usr/local/lib/node_modules/node-lambda/bin/node-lambda:89:12)
at Command.listener (/usr/local/lib/node_modules/node-lambda/node_modules/mander/index.js:301:8)
My index.js file has the handler declared like so
exports.myHandler = function(event, context) {
And the AWS_HANDLER in my .env is set to index.handler. I eel like I'm missing an obvious step.
Share Improve this question asked May 13, 2016 at 15:13 Richard AskewRichard Askew 1,2371 gold badge10 silver badges16 bronze badges 2-
18
You've named it
myHandler
. You either need to name ithandler
or change the name that you are telling Lambda to look for. – Mark B Commented May 13, 2016 at 15:18 - 1 I knew it would be simple. A million thanks! – Richard Askew Commented May 13, 2016 at 15:19
1 Answer
Reset to default 2use exports.handler = async function(event, context) {
instead of
exports.myHandler = function(event, context) {