Skip to content

fix(iam): handle missing Parameters block when StateMachineArn is a top-level Ref#720

Open
VirtueMe wants to merge 1 commit intomasterfrom
fix-468-nested-stepfn-ref
Open

fix(iam): handle missing Parameters block when StateMachineArn is a top-level Ref#720
VirtueMe wants to merge 1 commit intomasterfrom
fix-468-nested-stepfn-ref

Conversation

@VirtueMe
Copy link
Copy Markdown
Collaborator

Summary

  • Fixes a TypeError: Cannot read properties of undefined (reading 'StateMachineArn.$') crash in getStateMachineArn when a nested state machine is referenced via a top-level Ref: logicalId field (no Parameters block)
  • The guard was missing: the else branch assumed state.Parameters always exists, but ASL allows StateMachineArn as a top-level field
  • Falls back to state.StateMachineArn (e.g. { Ref: 'goodbyeMachine' }) or '*' when neither Parameters nor Arguments is present

Test plan

  • New test: should not throw when StateMachineArn is a top-level Ref (no Parameters block) — confirms no TypeError and resource is the Ref object
  • New test: should not produce null resource when StateMachineArn is Fn::GetAtt in Parameters — confirms intrinsic refs in Parameters pass through correctly
  • Full test suite: npm test — 499 passing

Closes #468

🤖 Generated with Claude Code

…op-level Ref

When a nested state machine is referenced via `Ref: logicalId` at the top
level of a Task state (no Parameters block), getStateMachineArn crashed with
TypeError: Cannot read properties of undefined (reading 'StateMachineArn.$').
Guard the Parameters access and fall back to state.StateMachineArn.

Fixes #468

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Mar 27, 2026

Open in StackBlitz

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

commit: 09b13b5

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.

TypeError when invoking nested step function by in stack reference

1 participant