0

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?

1 Answer 1

2

You have incorrectly set the region.

AWS.config.region = 'EU(Ireland)';

should be

AWS.config.region = 'eu-west-1';
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.