【发布时间】:2020-08-15 23:52:16
【问题描述】:
当我尝试从我的 API 调用我的 GET /dev/get-comments 端点时遇到错误。现在,我的 API 工作正常,因为我的另一个 GET /dev/get-posts 端点工作正常,两者之间的唯一区别是第一个端点使用请求正文。
API.get("holler-api", "/get-comments", {
body: {postId: this.props.post.postId}
}).then(result => {
if(result.Count > 0) {
this.setState({
comments: result.Items
});
}
})
.catch(err => console.log(err));
XHR GET https://xxxxxxxxxx.execute-api.us-east-1.amazonaws.com/dev/get-comments
[HTTP/2 403 Forbidden 23ms]
这是解释错误的请求响应,不是很有帮助!
SyntaxError: JSON.parse: bad control character in string literal at line 1 column 191 of the JSON data
{"message":"The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.
The Canonical String for this request should have been
'GET
/dev/get-comments
【问题讨论】:
标签: aws-lambda aws-api-gateway aws-amplify