1

I am trying to send some parameters to an AWS Lambda function from API Gateway, the problem is that Gateway sends all the empty parameters to the lambda, so it fails. I have reviewed the configurations that I know, which are not many, but I have not been able to solve it.

this is my request body:

{
      "functionName": "register",
      "name": "camilo",
      "nick": "kmilo",
      "email": "uncorreo@email.com",
      "phone": "555555",
      "birthdate": "29-09",
      "password": "000000"
    }

and the mapping template:

 {
  "functionName":"$input.params('functionName')",
  "name":"$input.params('name')",
  "nick": "$input.params('nick')",
  "email": "$input.params('email')",
  "phone": "$input.params('phone')",
  "birthdate": "$input.params('birthdate')",
  "password": "$input.params('password')"
}

The lambda function works correctly when I test them directly, so I assume the problem is in API Gateway

kmilo93sd
  • 791
  • 1
  • 15
  • 35
  • Can you provide some details on how you have configured API gateway? It's hard to debug without that information. – moebius Aug 02 '18 at 02:23

1 Answers1

0
{
    "functionName" = $input.json('$.functionName');
    "name":"$input.json('$.name')"
    //try for other body parameters as well.
}

Please refer to this link

AymDev
  • 6,626
  • 4
  • 29
  • 52