I'm using AWS lambda (Java Runtime) to process some files when there urls are inserted in DynamoDB via another API.
When the lamda dies due to timeout. The lambda is triggered back with the same event and the same process starts again. The process dies again due to timeout and the process starts again.
How can I stop the trigger when timeout occurs ?
The Logs are as follows:
10:53:25 START RequestId: 494ec72d-45bb-409f-bdd4-7653033eefda Version: $LATEST
10:53:25
Received event: com.amazonaws.services.lambda.runtime.events.DynamodbEvent@1e4a7dd4
10:53:25
Got an INSERT EVENT
10:53:25
KEY IS 3c39f7ea-76cf-484f-8a11-39bc2d7c1fd8/aws_dummy.pdf
10:55:25
END RequestId: 494ec72d-45bb-409f-bdd4-7653033eefda
10:55:25
REPORT RequestId: 494ec72d-45bb-409f-bdd4-7653033eefda Duration: 120035.00 ms Billed Duration: 120000 ms Memory Size: 512 MB Max Memory Used: 362 MB Init Duration: 2179.60 ms
10:55:25
2019-09-21T10:55:25.761Z 494ec72d-45bb-409f-bdd4-7653033eefda Task timed out after 120.03 seconds
10:55:28
START RequestId: 494ec72d-45bb-409f-bdd4-7653033eefda Version: $LATEST
10:55:28
Received event: com.amazonaws.services.lambda.runtime.events.DynamodbEvent@1e4a7dd4
10:55:28
Got an INSERT EVENT
10:55:28
KEY IS 3c39f7ea-76cf-484f-8a11-39bc2d7c1fd8/aws_dummy.pdf
public Integer handleRequest(DynamodbEvent event, Context context) {
for (DynamodbStreamRecord record : event.getRecords()) {
if (record.getEventName().equals("INSERT")) {
// DO SOME WORK
}
}
return (SOME_INTEGER)
}