-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
stepfunctions-tasks: CallAwsServiceCrossRegion doesn't work with WAIT_FOR_TASK_TOKEN #32746
Comments
@shatgupt Good afternoon. Thanks for opening the issue. Although unrelated to issue reproduction from CDK code perspective, at Wait for a Callback with Task Token, it's mentioned as a note that Thanks, |
Looking at the _renderTask() of the The fix should be in how we construct the base resource ARN: export class CallAwsServiceCrossRegion extends TaskStateBase {
// ... existing code ...
protected _renderTask(): any {
// Construct the proper service integration ARN
const serviceIntegrationArn = `arn:aws:states:::${this.service}:${this.action}`;
// If using WAIT_FOR_TASK_TOKEN, the service integration ARN will automatically
// get .waitForTaskToken appended by the Step Functions service
return {
Resource: serviceIntegrationArn,
Parameters: {
region: this.region,
parameters: this.parameters,
},
};
}
} Looking at aws-cdk/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/private/task-utils.ts Lines 23 to 27 in 946b748
This shows how the resource ARN suffixes are defined for different integration patterns:
And the integrationResourceArn function that uses these suffixes. The issue is that The key difference is that instead of using the Lambda function ARN, we should be using the proper service integration ARN format. The Step Functions service will handle appending .waitForTaskToken based on the integration pattern. This aligns better with how other service integration tasks work in the CDK. |
@ashishdhingra Thank you for mentioning that. I was aware of it and was expecting it to be pointed out that is why already mentioned it my report.
I have solved it using a similar workaround as your reference but with an SNS topic. |
This probably could be its own issue but I don't think CallAwsServiceCrossRegion task would work correctly with I am currently solving both the task token and assume role issues by creating a Lambda myself. |
We should have followed this 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, I guess we can introduce |
Describe the bug
CallAwsServiceCrossRegion
task doesn't generate the correctResource
required for WAIT_FOR_TASK_TOKEN to work. Because of this, SFN doesn't recognize the task as WAIT_FOR_TASK_TOKEN and thus$$.Task.Token
is not available in the task parameter to be passed to the call. See Reproduction Steps below.Regression Issue
Last Known Working CDK Version
No response
Expected Behavior
CallAwsServiceCrossRegion
should work with IntegrationPattern.WAIT_FOR_TASK_TOKEN so that the StateMachine can pass task token to another service in different account and region and wait on task completion after making a cross region call.The ASL generated from this task should be similar to the one generated by
CallAwsService
.I understand that SendTaskSuccess can only be called with the token using the current account principal.
Current Behavior
This task
generates following ASL
which throws following error during execution
Reproduction Steps
See code snippets in the Current Behavior.
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.173.4
Framework Version
No response
Node.js Version
18
OS
Mac
Language
TypeScript
Language Version
No response
Other information
No response
The text was updated successfully, but these errors were encountered: