-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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
[BUG] The "create" function under aws-python-http-api-with-pynamodb is not idempotent #659
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The function
create
under aws-python-http-api-with-pynamodb example is not idempotent and may create multiple extra todos.The
todo_id
is randomly generated. Thus, when the function fails after the new todo is saved, the function will be retried and create a new todo again with a differenttodo_id
. Similar issue exists in aws-python-rest-api-with-dynamodb/todos.This can be fixed by making the function idempotent. We can use the
awsRequestId
to betodo_id
. This is a unique identifier provided by AWS Lambda and is the same in retries. Then the function will create only one new todo. Another way to fix it is requiring the client to provide a parameter to betodo_id
. The client can generate such an identifier viauuid
API.The text was updated successfully, but these errors were encountered: