You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(stateMachine): create layer-aware version when useExactVersion is true (#452) (#757)
When useExactVersion: true, the plugin resolves Lambda refs to a specific
AWS::Lambda::Version resource. That resource's logical ID is generated by
Serverless Framework from the function's code artifact hash — so when only
a layer changes (same function code), the hash stays the same, no new version
is published, and the state machine definition is unchanged. CloudFormation
sees no diff and skips the update, leaving the step function invoking the
stale Lambda version.
Fix: after converting function refs to version refs, inspect the function's
Layers property. If layers are present, compute an MD5 hash over all layer
entries (Ref logical IDs, ARN strings, or any other intrinsic form) and
create a new AWS::Lambda::Version resource whose logical ID embeds that hash.
When layers change the hash changes, a new resource is created, CloudFormation
publishes a new Lambda version, and the state machine DefinitionString changes
so CloudFormation updates the state machine.
- Handles all layer reference forms: {Ref: logicalId}, plain ARN strings,
and any other intrinsic ({Fn::Sub}, {Fn::ImportValue}, etc.)
- Functions without layers are unaffected
- Add five unit tests covering: Ref layers, Ref layer version change,
ARN string layers, ARN version change, and no-op with no layers
- Add integration fixture use-exact-version with a layer and verify.test.js
asserting the layer-aware version resource and state machine reference
appear in the compiled CloudFormation template
Part of #452
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
0 commit comments