API context.requestTime 的网关映射模板为空
API Gateway Mapping Template for context.requestTime is Blank
我正在尝试让 API 网关充当 DynamoDB 的代理,我目前正在测试一个简单的 POST
调用以附加 $context.requestId
和 $context.requestTime
到我的 table。我收到以下 error 消息:
{
"__type": "com.amazon.coral.validate#ValidationException",
"message": "One or more parameter values were invalid: An AttributeValue may not contain an empty string"
}
发送的是:
Mon Apr 15 19:10:24 UTC 2019 : Endpoint request body after transformations: {
"TableName": "BurgerOrders",
"Item": {
"OrderId": {
"S": "1f54a90b-5fb2-11e9-8b31-c9003bb71ec2"
},
"RequestTime": {
"S": ""
}
}
}
我拥有的集成请求中的映射模板是:
{
"TableName": "BurgerOrders",
"Item": {
"OrderId": {
"S": "$context.requestId"
},
"RequestTime": {
"S": "$context.requestTime"
},
}
}
我尝试将 $context.requestTime
更改为 $context.requestTimeEpoch
,但我遇到了同样的错误。
我知道这是前一段时间发布的,但根据 AWS 开发人员的说法:
"At this time, [$context.requestTime] is only available when the API has been deployed and API call was invoked to deployed stage."
来源:https://forums.aws.amazon.com/thread.jspa?messageID=697652
我正在尝试让 API 网关充当 DynamoDB 的代理,我目前正在测试一个简单的 POST
调用以附加 $context.requestId
和 $context.requestTime
到我的 table。我收到以下 error 消息:
{
"__type": "com.amazon.coral.validate#ValidationException",
"message": "One or more parameter values were invalid: An AttributeValue may not contain an empty string"
}
发送的是:
Mon Apr 15 19:10:24 UTC 2019 : Endpoint request body after transformations: {
"TableName": "BurgerOrders",
"Item": {
"OrderId": {
"S": "1f54a90b-5fb2-11e9-8b31-c9003bb71ec2"
},
"RequestTime": {
"S": ""
}
}
}
我拥有的集成请求中的映射模板是:
{
"TableName": "BurgerOrders",
"Item": {
"OrderId": {
"S": "$context.requestId"
},
"RequestTime": {
"S": "$context.requestTime"
},
}
}
我尝试将 $context.requestTime
更改为 $context.requestTimeEpoch
,但我遇到了同样的错误。
我知道这是前一段时间发布的,但根据 AWS 开发人员的说法:
"At this time, [$context.requestTime] is only available when the API has been deployed and API call was invoked to deployed stage."
来源:https://forums.aws.amazon.com/thread.jspa?messageID=697652