Description
Use case
Problem:
Using aws-lambda-powertools==3.4.1
The prefix to the Idempotency key is hardcoded to force a fully qualified name based on the location of the function that uses the decorator. There is no simple way of modifying this behavior in order to make that prefix some static value.
This makes the Idempotency susceptible to future code refactoring. To prevent duplicate handling you can either
- Never move or rename the function decorated with
@idempotent_function
- Or, migrate all the keys in your Persistent Store
Solution/User Experience
A solution is to provide a way to override the key prefix on the @idempotent_function
function. An optional argument like idempotency_key_prefix
that allows a user to provided a fix string. This would allow freedom of refactoring (or even have multiple functions that are controlled by the same idempotency key space).
Considerations:
- This should only control the prefix. The standard behavior of appending
#<hash of arguments>
would stay intact - Not sure if this new feature should force the user to specify the entire prefix, or only the part that goes after the <lambda_name>. I lean towards the full prefix, and let the user decide how to fully qualify the key.
Alternative solutions
Acknowledgment
- This feature request meets Powertools for AWS Lambda (Python) Tenets
- Should this be considered in other Powertools for AWS Lambda languages? i.e. Java, TypeScript, and .NET
Metadata
Metadata
Assignees
Type
Projects
Status
Shipped