【发布时间】:2020-12-27 12:03:04
【问题描述】:
我的 Stepfunction 应该检查发电机中是否存在项目。如果是,则需要生成预签名的 url,否则必须更新 dynamodb 项。
当它与项目匹配时,它会按预期工作,因为当 dynamo getitem 输出为 null 时失败并出现 states.runtime 错误。它不通过 catch 语句。感谢任何帮助。
这是我的代码。
{ "Comment": "A Hello World example of the Amazon States Language using Pass states", "StartAt": "Hello", "States": {
"Hello": {
"Type": "Pass",
"Next": "Verify item from DynamoDB"
},
"s3_url": {
"Type": "Pass",
"Result": "Hello",
"End": true
},
"Verify item from DynamoDB": {
"Type": "Task",
"Resource": "arn:aws:states:::dynamodb:getItem",
"Parameters": {
"TableName": "s3_table",
"Key": {
"etag": {
"S.$": "$.Records[0].s3.object.eTag"
}
}
},
"ResultPath": "$.DynamoDB",
"OutputPath": "$.DynamoDB.Item",
"Next": "s3_url",
"Catch": [
{
"ErrorEquals": [
"States.Runtime"
],
"Next": "DynamoDB Update"
}
]
},
"DynamoDB Update": {
"Type": "Task",
"Resource": "arn:aws:states:::dynamodb:putItem",
"Parameters": {
"TableName": "s3_table",
"Item": {
"etag": {
"S.$": "$.eTag"
},
"filekey": {
"S": "mp3Files"
}
}
},
"End": true
} } }
【问题讨论】:
标签: amazon-dynamodb aws-step-functions