I have successfully invoked a lambda function from within my node file. It returns 200 and success, but I need to pass in a value to the function I am calling and am unsure how to do that. I am beginning to learn lambda and believe I am not understanding correctly how some things operate. I am attempting to pass in an email address to the lambda function.
function callLambda(){
var AWS = require('aws-sdk');
AWS.config.region = 'us-west-2'
var lambda = new AWS.Lambda();
var params = {
FunctionName: 'UploadDailyRecords',
Payload: '{"client_id" : "[email protected]"}'
};
lambda.invoke(params, function(err, data) {
if (err) console.log(err, err.stack);
else console.log(data);
});
}
callLambda();
Also, I am unsure of the correct format of how to invoke it from the other function to accept a variable from this invocation. This is the way the invoked lambda is set up on AWS.
exports.handler = function(event, context, callback) {
get_clients_email();
callback(null, "completed");
}
Thanks for any help.