Skip to content

Enhacement: Improve error message for IdempotencyAlreadyInProgressError when using a DynamoDB composite key #1800

Open
@phipag

Description

@phipag

Related issue in TypeScript: aws-powertools/powertools-lambda-typescript#3691.

When an idempotency operation is already in progress an IdempotencyAlreadyInProgressException exception is raised here: https://github.com/aws-powertools/powertools-lambda-java/blob/v2/powertools-idempotency/powertools-idempotency-core/src/main/java/software/amazon/lambda/powertools/idempotency/internal/IdempotencyHandler.java#L162.

This issue suggests to improve the error message when using a sort key in DynamoDB.

The implementation should not introduce a coupling between data store and idempotency handling!. See discussion: aws-powertools/powertools-lambda-typescript#3691 (comment).

Current behavior

Currently, the exception only contains the idempotency key. This key is dynamically determined in Java and is either the primary key (if the user doesn't use composite keys) or the sort key (if the user uses composite keys).

In the composite key configuration this is not enough to identify the item uniquely in DynamoDB and requires the users to have deep knowledge of the Powertools implementation to realize that the primary key is kept fixed which is not a good developer experience.

Desired behavior

Quoting @dreamorosi from aws-powertools/powertools-lambda-typescript#3691:

  • There is already an execution in progress with idempotency key: idempotencyKey and sort key: sk (when using composite key)
  • There is already an execution in progress with idempotency key: idempotencyKey

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions