Skip to content

feat(stepfunctions-tasks): add configurable timeout#38035

Open
lvthillo wants to merge 1 commit into
aws:mainfrom
lvthillo:feat/stepfunctions-tasks-cross-region-timeout
Open

feat(stepfunctions-tasks): add configurable timeout#38035
lvthillo wants to merge 1 commit into
aws:mainfrom
lvthillo:feat/stepfunctions-tasks-cross-region-timeout

Conversation

@lvthillo
Copy link
Copy Markdown
Contributor

Issue # (if applicable)

Closes #36823.

Reason for this change

The CallAwsServiceCrossRegion task creates an internal Lambda function to perform the cross-region AWS API call, but its timeout is hardcoded to 30 seconds. Long-running API calls (e.g. copying a large S3 object across regions, polling slow control-plane APIs) cannot complete within 30s and there is currently no way for users to override this.

Description of changes

  • Added a new optional lambdaTimeout?: Duration property on CallAwsServiceCrossRegionOptions. When unset, the
    default remains Duration.seconds(30), so existing behavior is preserved.
  • The value is wired through to the underlying CrossRegionAwsSdkSingletonFunction.
  • Added synth-time validation that the value is between 1 and 900 seconds (Lambda's allowed range). This is a
    fail-fast check for inputs that would always be rejected by CloudFormation at deploy time, so no feature flag is
    required.
  • Updated the aws-stepfunctions-tasks README with a new section explaining the default and how to override it,
    including a copyObject example.
  • Updated the existing integ.call-aws-service-cross-region integration test to exercise the new prop and
    regenerated its snapshot via a real deploy.

Naming note

The prop is named lambdaTimeout, not timeout. TaskStateBaseProps (the base props the construct extends)
already defines timeout as the Step Functions task timeout. Adding a second timeout prop with different
semantics on the merged interface would be confusing, so lambdaTimeout disambiguates that this controls the
internal Lambda's execution timeout rather than the Step Functions task timeout.

Describe any new or updated permissions being added

/

Description of how you validated changes

  • Added unit tests:
    • default Lambda timeout is 30 seconds — backwards-compatibility
    • with custom lambdaTimeout — verifies Duration.minutes(15) produces Timeout: 900
    • fails when lambdaTimeout is out of range (0 seconds) and (901 seconds) via test.each
  • Updated integ.call-aws-service-cross-region.ts to set lambdaTimeout: Duration.seconds(60) on the CreateTable
    task and regenerated the snapshot.
  • Ran a full deploy of the integration test in us-east-1 via integ-runner --update-on-failed — the state machine
    executed end-to-end successfully against real AWS.

Checklist


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@github-actions github-actions Bot added beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2 labels May 28, 2026
@lvthillo lvthillo force-pushed the feat/stepfunctions-tasks-cross-region-timeout branch from 38f0891 to 2fa4b48 Compare May 28, 2026 18:14
@aws-cdk-automation aws-cdk-automation added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2 pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(stepfunctions_tasks): Setting the timeout on the Lambda function constructed by CallAwsServiceCrossRegion

2 participants