【发布时间】:2023-03-28 06:49:01
【问题描述】:
我创建了一个简单的 api,它从 json 文件(作为输入传递)读取一个键并检查数据库是否存在 如果我在本地测试它
serverless invoke local --function getVin --path input/input_212.json
作品
在 AWS 上部署后如何使用 curl 进行测试?
我正在尝试
curl --request GET 'https://xxxx.execute-api.us-east-1.amazonaws.com/dev/vin' --header 'content-type: text/plain' --data-raw @input.json
或
curl -H "Content-Type: application/json" -X GET -d '{
"CustomerId": 213,
"VIN": "WDBJF65J1YB039213"
}' https://xxxxx.execute-api.us-east-1.amazonaws.com/dev/vin
但不适用于此错误
curl -H "Content-Type: application/json" -X GET -d '{
"CustomerId": 213,
"VIN": "WDBJF65J1YB039213"
}' https://xxxxx.execute-api.us-east-1.amazonaws.com/dev/vin
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE>ERROR: The request could not be satisfied</TITLE>
</HEAD><BODY>
<H1>403 ERROR</H1>
<H2>The request could not be satisfied.</H2>
<HR noshade size="1px">
Bad request.
We can't connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website owner.
<BR clear="all">
If you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation.
<BR clear="all">
<HR noshade size="1px">
<PRE>
Generated by cloudfront (CloudFront)
Request ID: iMPlncZFM2NQcVwotAWQmbear6akaktsKVTyin6Mmqcd7T5z0_Vijw==
</PRE>
<ADDRESS>
</ADDRESS>
</BODY></HTML>%
输入的 json 是这样的
{
"key1": 1,
"key2": "abcdefg"
}
【问题讨论】:
-
but does not work返回什么错误? -
添加错误信息
标签: python amazon-web-services curl aws-lambda serverless