title: AWS Lambda destination Lambda not triggering
body: <p><strong>Background:</strong></p>
  <p>I'm developing a custom AWS github-webhook via Terraform. I'm using AWS API Gateway to trigger an AWS Lambda function that validates the GitHub webhook's sha256 signature from the request header. If the lambda function successfully validates the request, I want a child lambda function to be invoked via the async invocation destination feature provided by Lambda.</p>
  <p><strong>Problem:</strong></p>
  <p>Even though I've configured the async invocation with the target child Lambda function, the child function is not triggered when the parent Lambda function is successful. This is reflected in the fact that the child Lambda function's associated CloudWatch log group is empty.</p>
  <p><strong>Relevant Code:</strong></p>
  <p>Here's the Terraform configuration for the Lambda function destination:</p>
  <pre><code>resource &quot;aws_lambda_function_event_invoke_config&quot; &quot;lambda&quot; {
    function_name = module.github_webhook.function_name
    destination_config {
      on_success {
        destination = module.lambda.function_arn
      }
    }
  }
  </code></pre>
  <p>If more code from the module is needed, feel free to ask in the comments. The entire source code for this module is here: <a href="https://github.com/marshall7m/terraform-aws-codebuild/tree/master/modules/dynamic-github-source" rel="nofollow noreferrer">https://github.com/marshall7m/terraform-aws-codebuild/tree/master/modules/dynamic-github-source</a></p>
  <p><strong>Attempts:</strong></p>
  <ul>
  <li>Made sure both parent/child Lambda functions have permission to create logs within their respective Cloudwatch log group (attached <code>arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole</code> policy to both)</li>
  <li>Made sure the parent Lambda function has the correct permission to invoke the child function: <code>&quot;lambda:InvokeFunction&quot;, &quot;lambda:InvokeAsync&quot;</code></li>
  <li>Setup async invocation for child lambda function for both success and failure parent Lambda runs (child function still not triggered)</li>
  <li>Add API integration request parameter `{'X-Amz-Invocation-Type': 'Event'} as mentioned in: <a href="https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-integration-async.html" rel="nofollow noreferrer">https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-integration-async.html</a></li>
  <li>For every attempt to fix this, I made sure to redeliver the request from the source (github webhook page) and not via the AWS Lambda console.</li>
  </ul>