I have a lambda processing kinesis events.
Kinesis has 3 retries in case of failure.
The lambda process the events properly but it is called 4 times.
I have looking for what can be the cause and I have found this:
[cloudshell-user@ip-10-130-89-49 ~]$ aws lambda list-event-source-mappings --event-source-arn arn:aws:kinesis:us-east-1:xxxx:stream/xxxx
{
"EventSourceMappings": [
{
"UUID": "xxx-xx-xx-xx-xxxx",
"StartingPosition": "LATEST",
"BatchSize": 100,
"MaximumBatchingWindowInSeconds": 3,
"ParallelizationFactor": 1,
"EventSourceArn": "arn:aws:kinesis:us-east-1:xxxxxx:stream/xxxxx-ingestion-kinesis",
"FunctionArn": "arn:aws:lambda:us-east-1:xxxxx:function:yyyyyy:PROD",
"LastModified": "2024-03-26T12:46:00+00:00",
"LastProcessingResult": "PROBLEM: Function response syntax is invalid. Please check function implementation.",
"State": "Enabled",
"StateTransitionReason": "User action",
"DestinationConfig": {
"OnFailure": {}
},
"MaximumRecordAgeInSeconds": 3600,
"BisectBatchOnFunctionError": true,
"MaximumRetryAttempts": 3,
"TumblingWindowInSeconds": 60,
"FunctionResponseTypes": []
}
]
}
I have been searching for
"PROBLEM: Function response syntax is invalid. Please check function implementation."
but I don´t find anything about it.
Any idea?
Your lambda code produces an error or at least the response is wrong and because of your setting
it calls the function 3 times after the initial call, because it interprets it as error.
You might read here for detailed explanation.