如何将查询参数传递给GET端点



我有一个简单的Lambda函数,它现在返回事件。测试时,返回event。body。urlevent.body.wepbSupport。这在AWS Lambda测试环境中有效。

测试
{
"body": {
"url": "https://someURL.com",
"webpSupport": true
}
}

反应

Test Event Name
test
Response
{
"url": "https://someURL.com",
"webpSupport": true
}

我不知道如何将这个查询字符串传递给staging API网关staging URL。来自AWS的所有文档都显示了他们已经更改的旧接口。我在这些说明中看到添加URL查询字符串参数,但在新界面中没有看到任何地方。

Cloudwatch日志显示:

{
"errorType": "TypeError",
"errorMessage": "The "url" argument must be of type string. Received undefined",
"code": "ERR_INVALID_ARG_TYPE",
"stack": [
"TypeError [ERR_INVALID_ARG_TYPE]: The "url" argument must be of type string. Received undefined",
"    at validateString (internal/validators.js:124:11)",
"    at Url.parse (url.js:170:3)",
"    at Object.urlParse [as parse] (url.js:157:13)",
"    at dispatchHttpRequest (/var/task/node_modules/axios/lib/adapters/http.js:91:22)",
"    at new Promise (<anonymous>)",
"    at httpAdapter (/var/task/node_modules/axios/lib/adapters/http.js:46:10)",
"    at dispatchRequest (/var/task/node_modules/axios/lib/core/dispatchRequest.js:52:10)",
"    at async Promise.all (index 0)",
"    at async Runtime.exports.handler (/var/task/index.js:4:28)"
]
}

检查事件对象后,我看到所有GET查询参数都在event. querystringparameters中传递。。把这个留在网站上,以防有人偶然发现这个问题。

相关内容

  • 没有找到相关文章

最新更新