# Cant invoke lambda from other lambda

**URL:** <https://forum.serverless.com/t/cant-invoke-lambda-from-other-lambda/16587>\
**Category:** Serverless Framework\
**Tags:** lambda\
**Created:** [January 20, 2022, 5:00pm UTC](https://forum.serverless.com/t/cant-invoke-lambda-from-other-lambda/16587 "2022-01-20T17:00:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![JohannesSchwegler](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/johannesschwegler/32/6521_2.png) [@JohannesSchwegler](https://forum.serverless.com/u/JohannesSchwegler)\
**Post date:** [January 20, 2022, 5:00pm UTC](https://forum.serverless.com/t/cant-invoke-lambda-from-other-lambda/16587/1 "2022-01-20T17:00:41Z")

</div>

Hi i`m trying to call another lambda from within a lambda. I always get the error  
“The request processing has failed because of an unknown error, exception or failure.” (statuscode: 500).  
This is my calling lambda:

```auto

export const saleOrderProcessingHandler: APIGatewayProxyHandler = async (
  event,
): Promise<APIGatewayProxyResult> => {
  console.log("!!!!!!! saleOrderProcessingHandler");
  let response;
  const requestData = JSON.parse(event.body);

  const lambda = new AWS.Lambda({
    region: "eu-west-1",
  });

  const sampleData = { number1: 1, number: 2 };

  const params = {
    FunctionName: "serverless-dev-child_lambda",
    Payload: JSON.stringify(sampleData),
  };

  try {
    await lambda.invoke(params, (res) => {
      console.log(res);
    });
  } catch (e) {
    console.log("invokeLambda :: Error: " + e);
  }

```

and this is the setup:

```auto
  child_lambda: {
    handler: "handler.mainHandler",
  },
  saleOrderProcessingAction: {
    handler: "handler.saleOrderProcessingAction",
    events: [
      {
        http: {
          method: "post",
          path: "saleOrderProcessing",
        },
      },
    ],
  },

```

!! Even when i change the name of the invoked lambda to child\_lambda, it doesn`t work.  
I also added IAM permissions

```auto
 {
        Effect: "Allow",
        Action: ["lambda:InvokeFunction", "lambda:InvokeAsync"],
        Resource: "*",
      },

```

---

<div class="post-metadata">

**Author:** ![corin](https://avatars.discourse-cdn.com/v4/letter/c/6de8d8/32.png) [@corin](https://forum.serverless.com/u/corin)\
**Post date:** [January 25, 2022, 4:01pm UTC](https://forum.serverless.com/t/cant-invoke-lambda-from-other-lambda/16587/2 "2022-01-25T16:01:46Z")

</div>

Based on the documentation it looks like you are invoking the lambda correctly. It is how I do it as well. When setting the FunctionName parameter make sure it matches exactly to the name of the lambda as deployed in AWS not as named in the serverless template.

In this case I would look closer at the logs for the calling lambda to be sure it is failing where you think it is failing. The 500 HTTP response just indicates the lambda failed. It could be on any part of the code. So review the lambda logs for detail on where it might be failing.
