0

My lambda function is triggered from dynamoDB table and such invocations are done synchronously. from docs

Lambda reads records from the stream and invokes your function synchronously with an event that contains stream records. Lambda reads records in batches and invokes your function to process records from the batch.

With asynchronous invocation, lambda gets 2 more tries in case of any unhandled errors. But in case of synchronous invocation, how many retires lambda will get? and how can we change it.

I want to reduce number of retries to 0 in case of an unhandled error. Is there a way to change number of retries for synchronous invocation?

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
Waleed Ahmad
  • 446
  • 3
  • 15

1 Answers1

0

From the doc you pointed out:

If your function returns an error, Lambda retries the batch until processing succeeds or the data expires.

That basically means that your data will be processed for a certain amount of time, rather than for a certain amount of retries.

If you know that you never want to retry anything, then avoid returning any error in your lambda. Just log the errors you could get, but don't return them so that the lambda will not be flagged as failed

aherve
  • 3,795
  • 6
  • 28
  • 41
  • my issue is lambda keeps retrying infinitely. I have made sure that it is not changing a resource that triggers it. So the only possible way is that its retrying in case of some unhandled error. Inside it, we are not returning any handled error. Is there a way to change retries for synchronous invocations just like for asynchronous invoke, we can change from aws console->lambda -> configurations so that it never retires. – Waleed Ahmad Aug 13 '21 at 04:43
  • 1
    If you have infinite retries, then look for the error instead of a way of shutting down the error management ! – aherve Aug 13 '21 at 08:05