Api Gateway将空参数发送到AWS Lambda [英] Api Gateway sends empty parameters to AWS lambda

查看:183
本文介绍了Api Gateway将空参数发送到AWS Lambda的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从API网关向AWS Lambda函数发送一些参数,问题是网关将所有空参数发送到lambda,因此失败.我查看了我所知道的配置,虽然数量不多,但我无法解决它.

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.

这是我的请求正文:

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

和映射模板:

 {
  "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')"
}

当我直接对其进行测试时,lambda函数可以正常工作,因此我认为问题出在API网关中

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

推荐答案

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

请参考此链接

这篇关于Api Gateway将空参数发送到AWS Lambda的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆