Skip to content

fix(stateMachine): handle plain string Fn::Sub when useExactVersion is true#744

Merged
zirkelc merged 1 commit intomasterfrom
fix-488-useexactversion-fnsub
Apr 1, 2026
Merged

fix(stateMachine): handle plain string Fn::Sub when useExactVersion is true#744
zirkelc merged 1 commit intomasterfrom
fix-488-useexactversion-fnsub

Conversation

@VirtueMe
Copy link
Copy Markdown
Collaborator

@VirtueMe VirtueMe commented Apr 1, 2026

Summary

  • Fixes a TypeError: Cannot assign to read only property '1' of string thrown during sls package
  • Triggered when useExactVersion: true is set and the state machine uses pseudo-parameters (#{}) but has no lambda function references
  • In this case Fn::Sub is a plain string (not an array), and the useExactVersion code path tried to assign to index [1] of that string
  • Fix converts the plain string form to the [template, {}] array form before applying the version conversion

Closes #488

Test plan

  • npm test passes
  • New test reproduces the exact TypeError before the fix and passes after

🤖 Generated with Claude Code

…s true

When a state machine uses pseudo-parameters (#{...}) but no lambda
function references, Fn::Sub is set to a plain string rather than
an array. The useExactVersion code path then tried to assign to
index [1] of that string, throwing a TypeError in strict mode.

Fix by converting the plain string form to the array form
[template, {}] before applying the version conversion.

Closes #488

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

pkg-pr-new bot commented Apr 1, 2026

Open in StackBlitz

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

commit: b7ad26d

@zirkelc zirkelc merged commit 60e195c into master Apr 1, 2026
3 checks passed
@zirkelc zirkelc deleted the fix-488-useexactversion-fnsub branch April 1, 2026 06:21
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.

Support lambda-less definitions with ${} style resource references

2 participants