(aws-stepfunctions-tasks): `DynamoPutItem` doesn't handle `IntegrationPattern.WAIT_FOR_TASK_TOKEN` correctly
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
### Describe the bug
I am using AWS StepFunctions and want to have a state, that puts something into a DynamoDB table. I need to wait for the task token. There for I am setting `integrationPattern: IntegrationPattern.WAIT_FOR_TASK_TOKEN`. However, this will not result in `arn:aws:states:::aws-sdk:dynamodb:putItem.waitForTaskToken`, `.waitForTaskToken` is missing in the deployed version. It works when using `CallAwsService` though.
Maybe related to https://github.com/aws/aws-cdk/issues/31474.
### Regression Issue
- [ ] Select this option if this issue appears to be a regression.
### Last Known Working CDK Version
_No response_
### Expected Behavior
`":states:::dynamodb:putItem.waitForTaskToken\"`
Full expectation:
```json
// ...
"Type": "AWS::StepFunctions::StateMachine",
"Properties": {
"DefinitionString": {
"Fn::Join": [
"",
[
"{\"StartAt\":\"DynamoPutItemState\",\"States\":{\"DynamoPutItemState\":{\"End\":true,\"Type\":\"Task\",\"ResultPath\":\"$.Put\",\"Resource\":\"arn:",
{
"Ref": "AWS::Partition"
},
":states:::dynamodb:putItem.waitForTaskToken\",\"Parameters\":{\"Item\":{\"pk\":{\"S\":\"foobar\"}},\"TableName\":\"",
{
"Ref": "MainConstructAppBackendConstructCheckStepFunctionConstructTable08775DAD"
},
"\"}}}}"
]
]
},
// ...
```
### Current Behavior
`":states:::dynamodb:putItem\"`
Full current:
```json
// ...
"Type": "AWS::StepFunctions::StateMachine",
"Properties": {
"DefinitionString": {
"Fn::Join": [
"",
[
"{\"StartAt\":\"DynamoPutItemState\",\"States\":{\"DynamoPutItemState\":{\"End\":true,\"Type\":\"Task\",\"ResultPath\":\"$.Put\",\"Resource\":\"arn:",
{
"Ref": "AWS::Partition"
},
":states:::dynamodb:putItem\",\"Parameters\":{\"Item\":{\"pk\":{\"S\":\"foobar\"}},\"TableName\":\"",
{
"Ref": "MainConstructAppBackendConstructCheckStepFunctionConstructTable08775DAD"
},
"\"}}}}"
]
]
},
// ...
```
### Reproduction Steps
```ts
new StateMachine(this, 'StateMachine', {
definitionBody: DefinitionBody.fromChainable(new DynamoPutItem(this, 'DynamoPutItemState', {
table: new Table(this, 'Table', { partitionKey: { name: 'pk', type: AttributeType.STRING } }),
resultPath: '$.Put',
integrationPattern: IntegrationPattern.WAIT_FOR_TASK_TOKEN,
item: {
pk: DynamoAttributeValue.fromString('foobar'),
},
})),
});
```
### Possible Solution
_No response_
### Additional Information/Context
_No response_
### CDK CLI Version
2.126.0 (build fb74c41)
### Framework Version
2.126.0
### Node.js Version
v20.17.0
### OS
macOS 15.3.1 (24D70)
### Language
TypeScript
### Language Version
5.2.2
### Other information
_No response_
Contributor guide
Research direction
Start with the DynamoPutItem implementation and compare its integration-pattern handling with CallAwsService, using the supplied TypeScript reproduction to synthesize the state machine. Done means the generated DefinitionString includes the .waitForTaskToken suffix for WAIT_FOR_TASK_TOKEN, with coverage for the reported behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- cloud
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100