-
Notifications
You must be signed in to change notification settings - Fork 421
Incomplete input for hash function for @idempotent_function #855
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
Thanks for opening your first issue here! We'll come back to you as soon as we can. |
hey @dispyfree thank you so much for spotting this - it's definitely an edge case we missed :/. We're fixing some papercuts elsewhere and this will be prioritized right after - More than happy to help review/guide the fix if you have some spare cycles too! Thanks again |
@heitorlessa @dispyfree - a basic fix for this in my PR (#869). I am just going to add a good unit test to reproduce the issue as well. |
merged - tagging for the next release hopefully this Friday |
Now released as part of 1.23 version - thank you again @dispyfree for flagging this |
When annotating functions via @idempotent_function, the wrapped function's name will not go into the hash computation; instead, only the payload and an environment-specific (but not function-specific) function name is assumed.
This causes idempotency to break in certain cases.
Expected Behavior
When two distinct functions which accept the very same payload as parameters are wrapped using @idempotent_function, invocation of one function should not affect invocation of the other function.
Current Behavior
Only the payload is considered.
The culprit appears to be
(lines 180-181) in
persistence/base.py
. One can clearly see that only the environment variable or "test-func" is assumed - but that is - of course - not specific to the actual function being wrapped.So in short, the library currently only really distinguishes by payload and not be function name, hence causing the aforementioned behaviour.
Possible Solution
Pass on the wrapped function's name and use it for the return value of
_get_hashed_idempotency_key
.Steps to Reproduce (for bugs)
This only prints myIdempotentFunc's output, so anotherIdempotentFunc never gets invoked.
Environment
Using "aws-lambda-powertools==1.22.0" on Python 3.9.7
Thank you in advance!
The text was updated successfully, but these errors were encountered: