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
{{ message }}
Repository navigation
Bug: parameters cache key ignores sdk_options, decrypt and recursive, so different requests share one cached value #8591
Two calls that fetch different data get different cache entries: get("flags", flag="a") vs flag="b" on the AppConfig extension, get_secret("s", VersionStage="AWSPREVIOUS") vs AWSCURRENT, get("/sec") vs get("/sec", decrypt=True), get_multiple("/p", recursive=False) vs recursive=True.
Current Behaviour
BaseProvider._build_cache_key (base.py:239) uses (name, transform, is_nested). sdk_options (base.py:101), decrypt and recursive all change the returned data but are not part of the key, so the second call is served the first call's value for max_age seconds. On SSM that means ciphertext returned to a decrypt=True call and a non-recursive subset returned to a recursive call.
Code snippet
frombotocore.configimportConfigfrombotocore.stubimportStubberfromaws_lambda_powertools.utilities.parametersimportSecretsProviderprovider=SecretsProvider(boto_config=Config(region_name="us-east-1"))
stub=Stubber(provider.client)
stub.add_response("get_secret_value", {"SecretString": "previous-value"}, {"SecretId": "s", "VersionStage": "AWSPREVIOUS"})
stub.activate()
print(provider.get("s", VersionStage="AWSPREVIOUS")) # 'previous-value'print(provider.get("s", VersionStage="AWSCURRENT")) # 'previous-value' from cache, no API call# same with SSMProvider: get("/sec") then get("/sec", decrypt=True) returns the cached ciphertext,# and get_multiple("/p", recursive=False) then recursive=True returns the non-recursive subset.
Possible Solution
Include a stable, hashable rendering of sdk_options in _build_cache_key, and have SSMProvider add decrypt/recursive to the key (they are passed as options already). Existing tests that assert cache hits across these calls will need adjusting.
Steps to Reproduce
Run the snippet above (it uses botocore.stub.Stubber, no AWS access needed).
Powertools for AWS Lambda (Python) version
latest
AWS Lambda function runtime
3.13
Packaging format used
PyPi
Debugging logs
Warning
This issue is ready to be picked up, by humans or by agents. If you want it, comment here first so we can assign it to you, and please take only one or two issues at a time so others can join in too. The reproduction above runs locally without AWS access. Thanks!
I'd like to take this one. Plan: add sdk_options (which carries decrypt and recursive on SSM, VersionStage on Secrets, flag on the AppConfig extension) to the cache key in BaseProvider, serialized so unhashable values work, plus Stubber tests for each case from the report.
Activity
mayuriphad commentedon Oct 18, 2026
I'd like to take this one. Plan: add sdk_options (which carries decrypt and recursive on SSM, VersionStage on Secrets, flag on the AppConfig extension) to the cache key in BaseProvider, serialized so unhashable values work, plus Stubber tests for each case from the report.
leandrodamascena commentedon Oct 18, 2026
Hey @mayuriphad pls go ahead.