I have one Lambda function which needs to invoke another lambda (InvocationType is set to 'Event'). I am calling invokeActionProcessor function (see below) to invoke this second lambda. When I test the code using AWS console, I see that I am calling the lambda.invoke (log statement before invoke is logging) but I don't see any invocation happening when I check the logs for the second lambda in cloudwatch management console. Trying to find out what might be the issue.
Note that first lambda is using IAM role that has "AWSLambdaFullAccess" policy attached. I checked various other similar threads on this topic but didn't see answer so posting this question.
function invokeActionProcessor(functionName, message) {
const payload = {
operation: PROCESS_MESSAGE,
message,
};
const params = {
FunctionName: functionName,
InvocationType: 'Event',
Payload: new Buffer(JSON.stringify(payload)),
};
return new Promise((resolve, reject) => {
console.log("invokeActionProcessor: invoking the function " + functionName);
try {
Lambda.invoke(params, function(err, data) {
if(err) {
console.log("invokeActionProcessor: got error: " + err);
reject(err);
} else {
console.log("invokeActionProcessor: success, " + data);
resolve(null, data);
}
});
} catch (err) {
console.log("invokeActionProcessor: got exception - " + err);
}
});
}