Home > Blockchain >  AWS Lambda: Getting error again and again in Logs
AWS Lambda: Getting error again and again in Logs

Time:01-17

I am using AWS for my app development. I am using a python lambda function in AWS.

This lambda function gets triggered when any item is modified in dynamodb table mytable.

I modified the item 2 hours ago. I changed its value from 4 to 5. And even after 2 hours I am still getting the error (right now also) in cloudwatch logs:

[ERROR] KeyError: 'OldImage'
Traceback (most recent call last):
  File "/var/task/lambda_function.py", line 16, in lambda_handler
    if (event['Records'][itert]['dynamodb']['NewImage']['amount']['S'] != event['Records'][itert]['dynamodb']['OldImage']['amount']['S']):

The surprising thing is that the error logs are coming again and again in the cloudwatch even after 2 hours since when I have stopped modifying items in dynamodb table. Why is that?

CodePudding user response:

Check the MaximumRetryAttempts parameter from Event Source Mapping Configuration.

From Event Source Mapping Configuration

With the default value, the function will retry to process the event indefinitely (until the records expire or exceed the maximum age that you configure on the event source mapping). You need to set an appropriate value according to your use case.

  •  Tags:  
  • Related