I am new to AWS and doing some exercises on lambda functions. I want to call a lambda function by another lambda function but it gives an error.
Both functions are assigned same execution role (which has "AWSLambdaExecute", AWSLambdaBasicExecutionRole, AWSLambdaFullAccess policies assigned) and no vpc is assigned to any.
{
"errorMessage": "2017-11-13T09:19:08.103Z b19fcd35-c853-11e7-a038-79c5d04b5126 Task timed out after 3.00 seconds"
}
Function invoking the "test" lambda function
var AWS = require('aws-sdk');
AWS.config.region = 'EU(Ireland)';
var lambda = new AWS.Lambda();
exports.handler = function(event, context) {
var params = {
FunctionName: 'test', // the lambda function we are going to invoke
InvocationType: 'Event',
Payload: '{ "name" : "Alex" }'
};
lambda.invoke(params, function(err, data) {
console.log("ds");
if (err) {
context.fail(err);
}
else {
context.succeed('Lambda test said '+ data.Payload);
}
})
};
"test" function
exports.handler = function(event, context) {
console.log('Lambda test Received event:', JSON.stringify(event, null,2));
context.succeed('Hello ' + event.name);
};
Can someone help me on this?