Skip to content

Fix crash when a resource's Metadata is not an object - #4784

Merged
kddejong merged 1 commit into
aws-cloudformation:mainfrom
Neg23:fix-null-resource-metadata
Oct 21, 2026
Merged

kddejong merged 1 commit into
aws-cloudformation:mainfrom
Neg23:fix-null-resource-metadata

Conversation

@Neg23

@Neg23 Neg23 commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Issue #, if available: #4769

Description of changes:

  • Template.get_directives now skips a resource whose Metadata is not an object (null, list, string) instead of raising AttributeError.
  • Because cfn-lint no longer crashes, E3028 now reports the invalid value: None is not of type 'object', 'array'.
  • Added a unit test covering null, list and string Metadata. It fails without the fix and passes with it.

The top-level Metadata crash (#4768) is in a different code path (ConfigMixIn.set_template_args), so I'll send it as a separate PR.

@kddejong
kddejong force-pushed the fix-null-resource-metadata branch from e30622d to c61d33a Compare October 21, 2026 00:00
@codecov

codecov Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.70%. Comparing base (16acc6f) to head (c61d33a).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4784   +/-   ##
=======================================
  Coverage   94.70%   94.70%           
=======================================
  Files         439      439           
  Lines       15895    15898    +3     
  Branches     3078     3079    +1     
=======================================
+ Hits        15053    15056    +3     
  Misses        459      459           
  Partials      383      383           
Flag Coverage Δ
unittests 94.70% <100.00%> (+<0.01%) ⬆️

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.

@kddejong
kddejong merged commit 108ef17 into aws-cloudformation:main Oct 21, 2026
21 checks passed
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.

2 participants