Skip to content

Feature request: allow to set idempotency prefix #3515

Closed
@leandrodamascena

Description

@leandrodamascena

Use case

Original issue: aws-powertools/powertools-lambda-python#5897

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.

https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/packages/idempotency/src/persistence/BasePersistenceLayer.ts#L55

This makes the Idempotency susceptible to future code refactoring. To prevent duplicate handling you can either

Solution/User Experience

A solution is to provide a way to override the key prefix on the makeIdempotent function. An optional argument like keyPrefix 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 # would stay intact

Alternative solutions

Python implementation + documentation: https://github.com/aws-powertools/powertools-lambda-python/pull/5898 

Acknowledgment

Future readers

Please react with 👍 and your use case to help us understand customer demand.

Metadata

Metadata

Assignees

Labels

completedThis item is complete and has been merged/shippedfeature-requestThis item refers to a feature request for an existing or new utilityidempotencyThis item relates to the Idempotency Utility

Type

No type

Projects

Status

Shipped

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions