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: get_parameters_by_name and get() use different cache keys, so they never share cache entries #8593
A parameter fetched by get("/a") is served from cache by a following get_parameters_by_name({"/a": {}}), and the other way around, as long as it is fresh.
Current Behaviour
get_parameters_by_name builds its cache key as (name, transform) (ssm.py:566 and :664), while BaseProvider._build_cache_key builds (name, transform, is_nested). The two never match, so the same parameter is fetched twice and stored twice. Inside get_parameters_by_name itself, a parameter that goes through the decrypt path (get()) and later through the batch path is also fetched again.
Code snippet
frombotocore.configimportConfigfrombotocore.stubimportStubberfromaws_lambda_powertools.utilities.parametersimportSSMProviderprovider=SSMProvider(boto_config=Config(region_name="us-east-1"))
stub=Stubber(provider.client)
resp1= {"Parameter": {"Name": "/a", "Value": "v", "Type": "String", "Version": 1}}
resp2= {"Parameters": [{"Name": "/a", "Value": "v", "Type": "String", "Version": 1}]}
stub.add_response("get_parameter", resp1, {"Name": "/a", "WithDecryption": False})
stub.add_response("get_parameters", resp2, {"Names": ["/a"]})
stub.activate()
provider.get("/a")
provider.get_parameters_by_name({"/a": {}}) # second API call for a value that is fresh in cacheprint(list(provider.store)) # [('/a', None, False), ('/a', None)]
Possible Solution
Use self._build_cache_key(name=name, transform=transform) in both places in ssm.py instead of building the tuple by hand.
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!
Activity
SumiRann1 commentedon Oct 18, 2026
Hii @leandrodamascena, after making a PR on similar issue before #8607, I want to take this as it has high similarities to work on!
leandrodamascena commentedon Oct 18, 2026
Hey @SumiRann1 thanks. Pls go ahead.