我想使用 aws cdk typescript 创建以下步骤函数。 这是代码片段截图: 我在打字稿中尝试了以下代码:
const finalStep = new sfn.Pass(this, 'FinalStep');
const fallBackJson={
Type: "Task",
Resource: "lambdaARN",
ResultPath: "$.taskresult",
InputPath: "$",
Next: "FinalStep"
};
// States language JSON to put an item into DynamoDB
// snippet generated from https://docs.aws.amazon.com/step-functions/latest/dg/tutorial-code-snippet.html#tutorial-code-snippet-1
const startRecordingJson = {
Type: "Task",
Resource: joinMeetingLambda.functionArn,
Parameters: {
"meetingId.$": "$.meetingId",
"projectId.$": "$.projectId",
"meetingURL.$": "$.meetingURL",
"subscriptionId.$": "$.subscriptionId",
"recordingAction": "start"
},
Retry: [
{
"ErrorEquals": [
"RecordingFailedToStart"
],
"IntervalSeconds": 1,
"MaxAttempts": 5,
"BackoffRate": 2
}
],
Catch: [
{
"ErrorEquals": [
"RecordingFailedToStart"
],
Next: "FallBack"
}
]
};
// custom state which represents a task to insert data into DynamoDB
const startRecordingState = new sfn.CustomState(this, 'InvokeRecording', {
stateJson: startRecordingJson,
});
const fallBackState = new sfn.CustomState(this, 'FallBack', {
fallBackJson,
});
const chain = sfn.Chain.start(startRecordingState)
.next(finalStep)
const sm = new sfn.StateMachine(this, 'StateMachine', {
definition: chain ,
timeout: cdk.Duration.seconds(30),
});
Invalid State Machine Definition: 'SCHEMA_VALIDATION_FAILED: The field 'Type' is required at /States/FallBack'