Skip to content

fix(parameters): handle transform failures gracefully in get_parameters_by_name - #8623

Open
Suraj1347 wants to merge 2 commits into
aws-powertools:developfrom
Suraj1347:fix/8594-graceful-transform-failures
Open

Suraj1347 wants to merge 2 commits into
aws-powertools:developfrom
Suraj1347:fix/8594-graceful-transform-failures

Conversation

@Suraj1347

@Suraj1347 Suraj1347 commented Oct 18, 2026 •

Copy link
Copy Markdown

Issue

Closes #8594

Summary

When raise_on_error=False, parameter transformation failures in get_parameters_by_name should be reported gracefully instead of unexpectedly raising an exception or caching a failed result.

Changes

Handle TransformParameterError in the decrypt and batch retrieval paths when graceful error handling is requested.

Record failed parameter names in _errors.

Omit failed batch transformations from the returned mapping and avoid caching failed results.

Preserve fail-fast behavior when raise_on_error=True.

Correctly handle valid JSON null values without treating them as transformation failures.

Tests and verification

Targeted get_parameters_by_name tests: 22 passed.

Full test_utilities_parameters.py: 130 passed.

Ruff check: passed.

Ruff format check: passed.

These checks were run locally. GitHub CI and maintainer review remain pending.

Acknowledgment

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

@Suraj1347
Suraj1347 requested a review from a team as a code owner October 18, 2026 19:08
@boring-cyborg boring-cyborg Bot added the tests label Oct 18, 2026
@powertools-for-aws-oss-automation powertools-for-aws-oss-automation Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Oct 18, 2026
@leandrodamascena leandrodamascena added this to the 3.39.0 milestone Oct 19, 2026
@Suraj1347 Suraj1347 removed their assignment Oct 19, 2026
@sonarqubecloud

Copy link
Copy Markdown

@Suraj1347

Copy link
Copy Markdown
Author

Hi, I accidentally removed my assignment from this PR and now GitHub doesn't show me an option to assign myself again. I'm still actively interested in maintaining this contribution. Could a maintainer please reassign me (@Suraj1347) to PR #8623? Thank you!

@leandrodamascena leandrodamascena left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Suraj1347, this is the right fix on both paths. I ran it against real Parameter Store with a SecureString and a String holding invalid JSON next to a valid one and a literal null: in graceful mode both failures now land in _errors, the good values come back, the null is returned as None without being counted as a failure, and nothing bad is cached, so a corrected parameter is picked up on the next call. Fail-fast still raises.

Approving. One note for the release notes, not for you: a failed transform is now omitted from the result instead of coming back as None, which is consistent with fetch failures but visible to anyone who checked for None.

This goes out in 3.39.0, so it will sit here for a while before I merge it. No rebase needed in the meantime, and you'll be credited in the release notes.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/L Denotes a PR that changes 100-499 lines, ignoring generated files. tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: get_parameters_by_name with raise_on_error=False still raises on transform errors in the decrypt path, and caches None

2 participants