amazon-web-services - 从 aws lambda 向 google firebse 函数发送 http 请求
问题描述
我已经设置了 firebase 函数来接收 http 请求,并验证了同样的工作。现在我试图从 aws lambda 函数向 firebase 发送 http 请求。但是在 aws lambda 或 firebase 函数日志中都没有响应。这是我的 aws lambda 代码:
const postData = JSON.stringify({
"queryresult" : {
"parameters": {
"on": "1",
"device": "1",
"off": ""
}
}
});
const options = {
hostname: 'https://<the firebase function endpoint>',
port: 443,
path: '',
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': Buffer.byteLength(postData)
}
};
const req = https.request(options, postData)
.then((response) => {
console.log(response);
})
.catch((err) => {
console.log(err);
});
// Write data to request body
req.write(postData);
req.end();
}
这里的承诺部分是假设执行控制台日志,但它没有被执行。有什么我在这里想念的吗。host是我们部署函数时获取的URL。或者是否存在一些与 firebase 或 aws 相关的计划问题。我在火力基地使用火花计划。谢谢你。
解决方案
推荐阅读
- c - 难以在 go 中访问嵌套的 C 联合成员
- c# - C# - XML 序列化 - 保持属性值不变
- sql - 如何创建多个 DATEDIFF 列?
- python - 通过在 python 3 中使用算术和逻辑运算符保留某些单词来标记单词?
- ios - 连接沙盒账户后如何处理死循环“需要登录”(iOS 13.1.2)
- r - 从整列中的字符串开头删除字符代码
- c++ - OpenGL catmull rom样条循环着色
- php - 使用列作为数组键
- c++ - /usr/bin/ld:构建调试/obj/gpsitem.o:文件无法识别:文件被截断
- javascript - 使用 JavaScript Ajax jQuery 将变量传递给 PHP