-
Notifications
You must be signed in to change notification settings - Fork 469
Description
Expected Behaviour
I started experiencing error where if lambda timeouts during executing idempotency in-progress is ignored and allows to submit the same lambda request again.
It was implemented within this PR #1387
After reviewing code I can not find way to override in_progress_expiry_timestamp value via configuration, because I do not want this value to be set to lambda timeout value.
I want this value to be set manually to desire duration for example 1 hour.
Current Behaviour
Lambda idempotency timeout handling was implemented within #1387
When Lambda timeouts while idempotency is in progress this allows to submit the same payload again.
For example if we passing idempotency_key and payload to make withdrawal within 3rd party API or start step function. If Lambda timeouts while executing it, it allows to repeat this action and ignores idempotency_key.
Currently it is no setting to change field value for in_progress_expiry_timestamp
Code snippet
https://github.com/aws-powertools/powertools-lambda-python/pull/1387/changes#diff-becc2a8b1233bddbb0d38b13a8634ab96bdd5d00f16f0514f6ea1df509c3b1d6R353
if remaining_time_in_millis:
now = datetime.datetime.now()
period = datetime.timedelta(milliseconds=remaining_time_in_millis)
timestamp = (now + period).timestamp()
data_record.in_progress_expiry_timestamp = int(timestamp * 1000)
else:
warnings.warn(
"Couldn't determine the remaining time left. "
"Did you call register_lambda_context on IdempotencyConfig?"
)Possible Solution
Allow field in_progress_expiry_timestamp value to be set via configuration.
Steps to Reproduce
- Configure idempotency for lambda
- Add lambda timeout for 10 seconds
- Invoke step function within lambda
- After invoking step function within handler add time.sleep(20) - to cause Lambda timeout
- Execute Lambda two times and observe that two executions within steps function (should be one)
Powertools for AWS Lambda (Python) version
latest
AWS Lambda function runtime
3.13
Packaging format used
PyPi
Debugging logs
Metadata
Metadata
Assignees
Labels
Type
Projects
Status