Skip to content

fix(iam): support intrinsic functions as StateMachineArn in JSONata Arguments#706

Closed
VirtueMe wants to merge 1 commit intoserverless-operations:masterfrom
BANCS-Norway:fix-704-jsonata-statemachine-arn
Closed

fix(iam): support intrinsic functions as StateMachineArn in JSONata Arguments#706
VirtueMe wants to merge 1 commit intoserverless-operations:masterfrom
BANCS-Norway:fix-704-jsonata-statemachine-arn

Conversation

@VirtueMe
Copy link
Copy Markdown
Collaborator

Summary

  • Fixes a TypeError: state.Arguments.StateMachineArn.trim is not a function crash when StateMachineArn in a JSONata Arguments block is an intrinsic function object (!Ref, !GetAtt) rather than a plain string
  • Guard the .trim() call with a typeof string check; non-string values are passed through as-is to the IAM policy resource

Test plan

  • Added test covering both Ref and Fn::GetAtt as StateMachineArn in JSONata Arguments — verifies the correct ARN object is used as the IAM resource
  • All 104 existing IAM role tests continue to pass

Fixes #704

🤖 Generated with Claude Code

…rguments

When using JSONata query language, StateMachineArn in Arguments can be
an intrinsic function object (Ref, Fn::GetAtt) instead of a string.
Guard the .trim() call with a typeof check so it is only applied to
strings, and treat non-string values as literal ARN references.

Fixes serverless-operations#704

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

pkg-pr-new bot commented Mar 20, 2026

Open in StackBlitz

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

commit: 12b6b00

@zirkelc
Copy link
Copy Markdown
Collaborator

zirkelc commented Mar 23, 2026

This was fixed earlier by #709

Please let me know if it can be closed or needs to be revised

@VirtueMe
Copy link
Copy Markdown
Collaborator Author

Closing in favour of #709 which was merged first and fixes the same issue with the same approach. Thanks for the quick fix @lracicot!

@VirtueMe VirtueMe closed this Mar 23, 2026
@VirtueMe VirtueMe deleted the fix-704-jsonata-statemachine-arn branch March 23, 2026 11:58
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.

StateMachineArn not supporting Intrinsic Functions when using JSONata

2 participants