Skip to content

fix(parameters): fix _transform_and_cache_get_parameters_response #7083

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

ericbn
Copy link
Contributor

@ericbn ericbn commented Jul 31, 2025

Issue number: #7084

Summary

Changes

_transform_and_cache_get_parameters_response was passing positional arguments to transform_value in the wrong order, making the latter fail miserably with

TransformParameterError: Unable to transform value using "the value"

because value was being passed as the expected transform argument. Use keyword arguments instead and cover this with a test.

User experience

get_parameters_by_name fails when used with transform. It's surprising that I might the first one trying to use this. 😅

Example:

    parameters = get_parameters_by_name(
        {"/dev/param1": {}, "/dev/param2": {}}, transform="json",
    )

Fails with:
aws_lambda_powertools.utilities.parameters.exceptions.TransformParameterError: Unable to transform value using '"value of /dev/param2"' transform: 'NoneType' object is not callable

Checklist

If your change doesn't seem to apply, please leave them unchecked.

Is this a breaking change?

RFC issue number:

Checklist:

  • Migration process documented
  • Implement warnings (if it can live side by side)

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.

@ericbn ericbn requested a review from a team as a code owner July 31, 2025 23:25
@ericbn ericbn requested a review from anafalcao July 31, 2025 23:25
@pull-request-size pull-request-size bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jul 31, 2025
@boring-cyborg boring-cyborg bot added the tests label Jul 31, 2025
@ericbn ericbn force-pushed the fix_transform_and_cache_get_parameters_response branch from 7272999 to aaf9707 Compare July 31, 2025 23:30
was passing positional arguments to transform_value in the wrong order,
making the latter fail miserably with

    TransformParameterError: Unable to transform value using "the value"

because value was being passed as the expected transform argument.
Use keyword arguments instead and cover this with a test.
@ericbn ericbn force-pushed the fix_transform_and_cache_get_parameters_response branch from aaf9707 to 81f598e Compare August 1, 2025 02:20
Copy link

codecov bot commented Aug 1, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.35%. Comparing base (954fe6f) to head (01e597e).
⚠️ Report is 2 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #7083      +/-   ##
===========================================
+ Coverage    96.34%   96.35%   +0.01%     
===========================================
  Files          275      275              
  Lines        12980    12980              
  Branches       965      965              
===========================================
+ Hits         12505    12507       +2     
+ Misses         367      366       -1     
+ Partials       108      107       -1     

☔ View full report in Codecov by Sentry.
📢 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.

@leandrodamascena
Copy link
Contributor

Hi @ericbn, bom te ver por aqui 😄

Thank you so much for identifying and fixing this issue! Could you please comment on the issue so I can assign it to you? #7084

@leandrodamascena leandrodamascena linked an issue Aug 1, 2025 that may be closed by this pull request
@leandrodamascena leandrodamascena requested review from leandrodamascena and removed request for anafalcao August 1, 2025 07:53
@github-actions github-actions bot added the bug Something isn't working label Aug 1, 2025
@ericbn
Copy link
Contributor Author

ericbn commented Aug 1, 2025

Oi @leandrodamascena. Sempre um prazer quando surge uma oportunidade pra contribuir mais um pouco de volta!

I've commented on #7084. Let me know if you need more context there.

Copy link

sonarqubecloud bot commented Aug 4, 2025

Copy link
Contributor

@leandrodamascena leandrodamascena left a comment

Choose a reason for hiding this comment

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

Hey @ericbn! OBRIGADO!

APPROVED! ❤️

@leandrodamascena leandrodamascena merged commit 8a1854b into aws-powertools:develop Aug 4, 2025
14 checks passed
@ericbn ericbn deleted the fix_transform_and_cache_get_parameters_response branch August 4, 2025 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working size/M Denotes a PR that changes 30-99 lines, ignoring generated files. tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: get_parameters_by_name method should work with transform
2 participants