[aws-stepfunctions-tasks] Unable to use the Wait for task Token: Task Token is missing in payload (pass Context.taskToken somewhere in payload)
See original GitHub issue❓ How to specify the task token + pass input on the payload with the RunLambdaTask
The Question
How can I specify a task that uses the wait for task token using CDK.
The README does not contain an example using the RunLambdaTask (https://github.com/aws/aws-cdk/tree/master/packages/%40aws-cdk/aws-stepfunctions-tasks#lambda) so I took the existing one and adapted like below
const reserveHotel = new sfn.Task(this, 'doX', {
task: new tasks.RunLambdaTask(doXLambda, {
integrationPattern: sfn.ServiceIntegrationPattern.WAIT_FOR_TASK_TOKEN,
payload: sfn.TaskInput.fromObject({
taskToken: "$$.Task.Token",
input: "$"
})
}),
resultPath: '$.Result'
}).addCatch(otherTask, {
resultPath: "$.Error"
});
When trying to use cdk synth it complains “Task Token is missing in payload (pass Context.taskToken somewhere in payload)”.
I’ve tried variations using the sfn.Context.taskToken
but same result.
I guess it would be beneficial to update the ReadME to indicate the correct way of doing so.
Environment
- CDK CLI Version: 1.54.0 (build c01b9b9)
- Module Version: Not sure
- Node.js Version: 12.18.3
- OS: Ubuntu 20
- Language (Version): Typescript
Other information
Issue Analytics
- State:
- Created 3 years ago
- Comments:12 (6 by maintainers)
Top Results From Across the Web
aws cdk - Aws StepFunction path with waitForTaskToken
I think you want to pass resultPath to props instead of payload . const publishIot = new tasks. ... taskToken, request: sfn.JsonPath.
Read more >aws-cdk/aws-stepfunctions-tasks module
When passing the Task Token in the headers field WAIT_FOR_TASK_TOKEN integration, use JsonPath.array() to wrap the token in an array: import * as...
Read more >Handling Step Function Task Tokens failures with CDK
This post shows you how to handle failures with Step Functions Task Tokens in AWS CDK.
Read more >Combine AWS Step Functions with CloudWatch Events using ...
aws-cdk; Step Function; Lambda. The example demonstrates how Step Functions manage execution of a process, which involves external events e.g. ...
Read more >aws-cdk.aws-stepfunctions
entirePayload, reference the entire data object (equivalent to a path of $ ). JsonPath.taskToken, reference the Task Token, used for integration patterns ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Did the trick. I hope it is the right way.
@mariobittencourt great!
I should also mention the default should be the entire payload if you’re using
LambdaInvoke
. you shouldn’t need to explicitly specify it unless you’re selecting part of the state input.