Skip to content

Feature request: Idempotency prefix is susceptible to refactoring #703

@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-dotnet/blob/develop/libraries/src/AWS.Lambda.Powertools.Idempotency/Persistence/BasePersistenceStore.cs#L59

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature-requestNew or enhancements to existing features

    Type

    No type

    Projects

    Status

    📋 Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions