Reputation: 194
Just figured out that my Lambda function invocated twice with the same RequestID and the save Event, in our code, we assumed that any event comes once.
12:27:23
START RequestId: e511fe17-13b1-11e7-ab4f-5b2cfaa6339f Version: $LATEST
....
12:37:23
START RequestId: e511fe17-13b1-11e7-ab4f-5b2cfaa6339f Version: $LATEST
The 2nd invocation was after 600 seconds. Looks very strange...
Need help with the following things:
Until we will resolve the problem, we want to know how much time it happens? Today we didn't found a way to measure the problem
Any explanation for why this happens? It somehow can be a bug in our flow? maybe one of the integrations?
Any workaround a way to know Inside the invocation code that this is request-id that already handled, and skips this
Currently it's causing a bug in our application, we count some of the user actions twice even they happened only once.
Upvotes: 1
Views: 2324
Reputation: 797
AWS Lambda invokes at least once. If there is any error then it retries again. So make sure if there is any failure you are handling it and in case of success you are returning from the lambda function. I have seen that if you don't return from the handler function then lambda treats it as an error. I have added my learning here. it will help others to solve this problem.
Upvotes: 0
Reputation: 23
Just set retry count as zero and rerun . Most likely this occurs when your AWS Lambda get fails. I faced this issue while AWS lambda invocation as custom resource from AWS Cloud formation. I haven't controlled cfn response and ended up with twice invocation.
Upvotes: 2
Reputation: 8057
Most likely, the first invocation either fails or times out. In this case, lambda will re-try.
Upvotes: 0