-
Notifications
You must be signed in to change notification settings - Fork 421
Bug: Idempotency DynamoDB _put_record method overwrites static_pk_value #1968
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hey @Tankanow - feel free to send a PR for this, as you're a highly regarded contributor ;-) I do wonder if we missed this earlier during implementation, or if it's a regression. Since you last contributed we now have E2E tests ;-) Thank you as always PS: dinner time now but can look into it first thing tomorrow morning, and cut a patch release |
Hi @heitorlessa, I believe it is a regression. We found it in our unit tests that consume this code after upgrading to |
Hmmm no bueno and surprises me since we had tests for that. Last change on Idempotency persistence later was this that made it thread-safe. Barely keeping my eyes open but can investigate it tomorrow morning (CET) and cut a patch release ASAP. |
sadly it was added in the PR that addressed thread-safety (larger structural change) - got my laptop now, eye dropper and looking into it what test was changed that shouldn't have, and cutting a patch release if confirmed. |
looking at git blame and history, there wasn't an explicit test for this feature @Tankanow You opened a PR in your base branch instead of the origin ;) Feel free to correct it, and I can make minor modifications, merge, and release |
PR up, copied tests over to make this quicker, will credit as usual, and will double check one more time to be safe. |
@Tankanow - good to go. I'll wait a few minutes to hear it's okay to merge from you, otherwise I'll go ahead. |
Release in process - might take ~2m for PyPi and 30m for Lambda Layer (v23) to be available across all regions. https://github.com/awslabs/aws-lambda-powertools-python/actions/runs/4307851934 |
PyPi test is under maintenance... 🤦 removed PyPi test endpoint from the release temporarily, and it's now available as 2.9.1: https://pypi.org/project/aws-lambda-powertools/ Starting to build Layers and will deploy across all regions if canaries pass - ~30m ETA. |
This is now released under 2.9.1 version! |
@Tankanow please let us know if it didn't fix it somehow. Just published the release notes and credited you accordingly PS: I'd love to hear from you one of these days on how you're using Powertools, share our main ideas for this year (all public either way), and gather your feedback on areas we could innovate/do better -- shoot an email to [email protected] and we can send you a link for a call. |
Thanks @heitorlessa. I would love to help! I'll send an email over this morning. |
Expected Behaviour
When I pass a
static_pk_value
value into theDynamoDBPersistenceLayer
, I expect that value to be used in the Primary Key.Current Behaviour
The
PK
value is overwritten withdata_record.idempotency_key
.Code snippet
Possible Solution
Simply remove the offending line,
self.key_attr: {"S": data_record.idempotency_key},
in https://github.com/Tankanow/aws-lambda-powertools-python/blob/5f9addda12d3c4066fe7f480f99184126b154d57/aws_lambda_powertools/utilities/idempotency/persistence/dynamodb.py#L149.Steps to Reproduce
Run the tests in this PR
I will happily fix if this issue is accepted.
AWS Lambda Powertools for Python version
latest
AWS Lambda function runtime
3.9
Packaging format used
PyPi
Debugging logs
No response
The text was updated successfully, but these errors were encountered: