Skip to content

Bug: Incorrect error message for IdempotencyAlreadyInProgressError when sortKeyAttr is in use #3691

Closed
@mikesnare

Description

@mikesnare

Expected Behavior

When an IdempotencyAlreadyInProgressError is thrown, the error message should include the hashed key information.

Current Behavior

Currently, the error message only includes the partition key, but when a sortKeyAttr has been provided in the config the partition key is a static string. The leads to meaningless errors in the log that all say there's a IdempotencyAlreadyInProgressError error for the same key.

Code snippet

// none

Steps to Reproduce

Set up idempotency and provide a sortKeyAttr in the config, then send duplicate events in quick succession. You will get errors that reference only the partition key, but the partition key is static in this scenario and is therefore not very helpful for debugging.

Possible Solution

Include both the pk/sk, or detect the current scenario better and include the more meaningful one.

Powertools for AWS Lambda (TypeScript) version

latest

AWS Lambda function runtime

20.x

Packaging format used

npm

Execution logs

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcompletedThis item is complete and has been merged/shippedidempotencyThis 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