fix(stepfunctions-tasks): CallAwsServiceCrossRegion
doesn't work with WAIT_FOR_TASK_TOKEN
#32807
+33,004
−10
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue # (if applicable)
Closes #32746
Reason for this change
The Step Functions task
CallAwsServiceCrossRegion
did not work withintegrationPattern.WAIT_FOR_TASK_TOKEN
. This PR fixes the problem.Description of changes
The root cause of this problem is that we used an alterntive form of calling Lambda Invoke, which does not support waitForTaskToken integration pattern.
https://docs.aws.amazon.com/step-functions/latest/dg/connect-lambda.html#connect-lambda-api-examples
This PR fixes the code to align with the implementation in
LambdaInvoke
task, which supports both integration pattern.aws-cdk/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/lambda/invoke.ts
Lines 146 to 165 in bbdd42c
To fix this without breaking changes, we introduce
payloadResponseOnly
property (true by default), and fix the_renderTask
method as above. Users who need other integration patterns can setpayloadResponseOnly: false
.Additionally we throw an error if
payloadResponseOnly == true && integrationPattern != REQUEST_RESPONSE
to prevent misconfiguration. This is not a breaking change because the construct previously did not work at all whenintegrationPattern != REQUEST_RESPONSE
.Describe any new or updated permissions being added
No.
Description of how you validated changes
Added unit tests and integ tests.
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license