问题
{
"version": "2017-02-28",
"operation": "PutItem",
"key": {
"id": $util.dynamodb.toDynamoDBJson($util.autoId()),
"createdDate":$core_v2_utility.CurrentDate
},
"attributeValues": $util.dynamodb.toMapValuesJson($ctx.args.input),
"condition": {
"expression": "attribute_not_exists(#id)",
"expressionNames": {
"#id": "id",
"#createdDate":"createdDate",
},
},
}
I have been trying to add a createDate into DynamoDB using VTL.I am finding error with $core_v2_utility.CurrentDate
回答1:
AWS AppSync does not have a $core_v2_utility.CurrentDate
. Did you mean to use one of the time helpers? $util.time.nowFormatted("yyyy-MM-dd HH:mm:ssZ")
gives you the current date and time in UTC.
来源:https://stackoverflow.com/questions/53625805/how-to-add-current-date-in-putitem-in-vtl