无法将POST数据发送到Lambda [英] Cannot send POST data to Lambda

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

问题描述

我正在尝试将数据发送到我的lambda函数,但是该函数未获取我的数据,event变量为空.我没有收到任何错误,当我在API网关中测试该功能时,它可以正常工作.所以我不确定发生了什么.我向Lambda发送数据的代码如下.

I am trying to send data to my lambda function however the function is not getting my data, the event variable is empty. I am not getting any errors and when I test the function in my API Gateway it works fine. So I am not sure what is happening. My code for sending data to Lambda is below.

var options = { 
    method: 'POST', 
    url: 'correct api url', 
    contentType: "application/json",
    dataType: "json",
    data: s
}

在我的控制台中,

看起来像这样data: '{"article_url":"a url here"}'

for data: s within my console looks like this data: '{"article_url":"a url here"}'

有什么问题吗?

推荐答案

在集成请求"配置中,确保已选中使用Lambda代理集成"复选框.

In the "Integration Request" configuration, make sure you've checked the "Use Lambda Proxy integration" checkbox.

并确保您的输出与此处定义的架构匹配,以避免错误:

And make sure your output matches the schema defined here to avoid errors:

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

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