Skip to content

fix(toolkit-lib): hotswap deployments fail with TypeError when a nested stack output joins a List<> parameter - #1842

Merged
aws-cdk-automation merged 1 commit into
aws:mainfrom
9pace:fix/hotswap-nested-list-param-join
Aug 17, 2026
Merged

fix(toolkit-lib): hotswap deployments fail with TypeError when a nested stack output joins a List<> parameter#1842
aws-cdk-automation merged 1 commit into
aws:mainfrom
9pace:fix/hotswap-nested-list-param-join

Conversation

@9pace

@9pace 9pace commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Fixes #1829

Hotswap deployments crash with an uncaught TypeError: evaluatedArgs.join is not a function when a nested stack output uses Fn::Join on a List<>-typed parameter. The nested-stack evaluator was seeded with parameter declarations (e.g. {"Type": "AWS::SSM::Parameter::Value<List<String>>"}) instead of the values from the parent resource's Properties.Parameters, and the resulting TypeError escaped the CfnEvaluationException-only handler, aborting the deployment instead of falling back to CloudFormation.

Two-part fix:

  1. Seed the nested evaluator with Properties.Parameters from the parent resource, so Ref resolves to actual values.
  2. Add assertEvaluatesToArray / assertEvaluatesToString guards to Fn::Join, Fn::Split, and Fn::Select, throwing CfnEvaluationException (caught, triggers CloudFormation fallback) instead of a raw TypeError. The guards are required even with the seed fix: a nested stack resource without Properties.Parameters seeds {}, Ref falls through to the declaration's Default (a non-array), and only the guard prevents the crash.

Known limitation: CloudFormation's nested-stack Parameters map is Map<String, String>, so list values arrive as "val1,val2,val3" and fall back to CloudFormation instead of hotswapping (possible follow-up).


  • Unit tests added/updated

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.29%. Comparing base (750d650) to head (9bde153).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1842      +/-   ##
==========================================
- Coverage   90.32%   90.29%   -0.04%     
==========================================
  Files          80       80              
  Lines       12124    12124              
  Branches     1716     1714       -2     
==========================================
- Hits        10951    10947       -4     
- Misses       1139     1143       +4     
  Partials       34       34              
Flag Coverage Δ
suite.unit 90.29% <ø> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

…ed stack output joins a List<> parameter

Root cause: the nested-stack evaluator was seeded with parameter
declarations (e.g. {Type: "AWS::SSM::Parameter::Value<List<String>>"})
instead of the concrete values from the parent resource's
Properties.Parameters map. When Fn::Join received this object instead
of an array, a raw TypeError escaped the CfnEvaluationException-only
handler and aborted the deployment rather than falling back to
CloudFormation.

Fix is two-part:
1. Seed the nested evaluator with
   `this.template.Resources?.[logicalId]?.Properties?.Parameters ?? {}`
   so Ref resolves to actual parameter values.
2. Add assertEvaluatesToArray / assertEvaluatesToString guards on
   Fn::Join, Fn::Split, and Fn::Select so that any future type mismatch
   throws CfnEvaluationException (caught and triggers CloudFormation
   fallback) rather than an uncatchable TypeError.

Fixes aws#1829
@9pace
9pace force-pushed the fix/hotswap-nested-list-param-join branch from 9bde153 to 2eb2712 Compare August 17, 2026 13:45
@aws-cdk-automation
aws-cdk-automation added this pull request to the merge queue Aug 17, 2026
Merged via the queue into aws:main with commit bee9159 Aug 17, 2026
26 of 27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(hotswap): TypeError: evaluatedArgs.join is not a function when a nested stack Output joins a List<> CFN parameter

4 participants