【发布时间】:2022-10-06 23:25:35
【问题描述】:
我在 AWS Cloud9 中进行开发,并使用 Lambda 设置了一个基本的“Hello, World”API。
现在我想迭代以便 API 可以接受参数。 Cloud9 曾经有一个方便的 UI,用于在运行“本地”时修改有效负载(在 IDE 中,没有部署)。但是我找不到这个被移动的地方,并且文档仍然引用了以前的 UI。
为了测试这一点,我在我的 Lambda 中包含了一个简单的print(event),并开始修改各种组件。到目前为止,我只打印一个空字典 ({})。
我怀疑它在launch.json 中,但到目前为止我修改的所有内容都没有被拾取。如下所示
{
\"configurations\": [
{
\"type\": \"aws-sam\",
\"request\": \"direct-invoke\",
\"name\": \"API token-to-geojson:HelloWorldFunction (python3.9)\",
\"invokeTarget\": {
\"target\": \"api\",
\"templatePath\": \"token-to-geojson/template.yaml\",
\"logicalId\": \"HelloWorldFunction\"
},
\"api\": {
\"path\": \"/hello\",
\"httpMethod\": \"get\",
\"payload\": {
\"json\": {}
}
},
\"lambda\": {
\"runtime\": \"python3.9\"
}
},
{
\"type\": \"aws-sam\",
\"request\": \"direct-invoke\",
\"name\": \"token-to-geojson:HelloWorldFunction (python3.9)\",
\"invokeTarget\": {
\"target\": \"template\",
\"templatePath\": \"token-to-geojson/template.yaml\",
\"logicalId\": \"HelloWorldFunction\"
},
\"lambda\": {
\"payload\": {
\"ticky\": \"tacky\"
},
\"environmentVariables\": {},
\"runtime\": \"python3.9\"
}
}
]
}
标签: aws-lambda cloud9-ide