Skip to content

feat(stateMachines): add configureTaskTimeouts to mirror Lambda timeouts#768

Merged
zirkelc merged 1 commit intomasterfrom
feat/239_task-timeouts
May 6, 2026
Merged

feat(stateMachines): add configureTaskTimeouts to mirror Lambda timeouts#768
zirkelc merged 1 commit intomasterfrom
feat/239_task-timeouts

Conversation

@VirtueMe
Copy link
Copy Markdown
Collaborator

@VirtueMe VirtueMe commented May 5, 2026

Closes #239

Summary

  • Opt-in configureTaskTimeouts: true flag auto-injects TimeoutSeconds into Task states that invoke a project Lambda, bridging the gap that Lambda timeouts surface as States.TaskFailed rather than States.Timeout.
  • Pure planner returns Decision[] (inject | warn-overlong); thin applier mutates the definition and emits warnings via injected log callback — keeps decision and effect decomplected.
  • Resolves both legacy direct invoke (Resource: Fn::GetAtt) and service integration (arn:aws:states:::lambda:invoke[.sync|.waitForTaskToken]); recurses into Parallel branches and Map ItemProcessor/Iterator.
  • Preserves user-set TimeoutSeconds/TimeoutSecondsPath; warns only when user TimeoutSeconds is strictly greater than the Lambda timeout.
  • Fallback chain: function.timeoutprovider.timeout6 (Serverless Framework default).

Test plan

  • Unit: planner / applier / orchestrator (configureTaskTimeouts.test.js — 19 tests)
  • Integration: schema + compile-pipeline wiring (compileStateMachines.test.js — 3 new tests)
  • Verify fixture against generated CF template (fixtures/configure-task-timeouts/verify.test.js — 5 tests)
  • Manual smoke test deploying a state machine with configureTaskTimeouts: true

🤖 Generated with Claude Code

Adds an opt-in `configureTaskTimeouts: true` flag on a state machine that
auto-injects `TimeoutSeconds` into Task states invoking project Lambdas.
Bridges the gap that Lambda timeouts don't surface as `States.Timeout`.

- Pure planner returns Decision[] (inject | warn-overlong); thin applier
  mutates the definition and emits warnings via injected log callback
- Resolves both legacy direct invoke (Resource: Fn::GetAtt) and service
  integration (arn:aws:states:::lambda:invoke[.sync|.waitForTaskToken])
- Recurses into Parallel branches and Map ItemProcessor/Iterator
- Preserves user-set TimeoutSeconds/TimeoutSecondsPath; warns only when
  user TimeoutSeconds is strictly greater than the Lambda timeout
- Fallback chain: function.timeout -> provider.timeout -> 6 (Serverless
  Framework default)
- Integration fixture asserts CF template contains expected timeouts

Closes #239

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 5, 2026

Open in StackBlitz

npm i https://pkg.pr.new/serverless-operations/serverless-step-functions@768

commit: afd31f0

@zirkelc zirkelc merged commit 41d1cb5 into master May 6, 2026
4 checks passed
@zirkelc zirkelc deleted the feat/239_task-timeouts branch May 6, 2026 12:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Set the TimeoutSeconds for Task states

2 participants