Description
Expected Behaviour
When I call parameters.get_parameter
using the AppConfigProvider
more than once with different parameter names, I expect to get the corresponding values for each configuration profiles in AppConfig.
The code in the _get
method on AppConfigProvider
stores the configuration session from the first time it is called and re-uses it. The problem is that the configuration session is associated with a single configuration profile, and you can see that the name
parameter is ignored once a session is started. Here you can see the retrieval and storage of the token irrespective of the name of the field:
I've also noticed that DEFAULT_PROVIDERS
holds a copy of an AppConfigProvider
established using the application and environment from the first call, and re-uses it:
I think this means that we'll also not be able to provide a different application or environment for subsequent calls - in this case, I imagine it could be by design (a running application has a single identity and a single environment?)
Current Behavior
The first call works as expected, the second call returns the value from the configuration profile associated with the first call.
Code snippet
These will both end up with the value of param1
:
param_1 = parameters.get_app_config(name="param1", environment="dev", application="example")
param_2 = parameters.get_app_config(name="param2", environment="dev", application="example")
Possible Solution
Powertools for typescript stores the session tokens keyed on the parameter / configuration profile name:
Steps to Reproduce
Fetch two different parameters within the same lambda execution
Powertools for AWS Lambda (Python) version
latest
AWS Lambda function runtime
3.7
Packaging format used
PyPi
Debugging logs
No response