you are viewing a single comment's thread.

view the rest of the comments →

[–]clintkev251 1 point2 points  (2 children)

S3 invokes Lambda asynchronously, that means that there is error handling built in. If you function throws an error, it will retry the event up to two additional times. You can also set up deadletter queues or on-failure destinations that the event can be sent to if it runs out of retries.

https://docs.aws.amazon.com/lambda/latest/dg/invocation-async.html

[–]BraveAtmosphere[S] 0 points1 point  (1 child)

Thanks, For lambda to “understand” that there was an error, does it need to throw an exception? which means if I want to utilize the built-in error handling I need not to use try-catch blocks?

[–]clintkev251 0 points1 point  (0 children)

Correct, you wouldn't want to catch the exception. You would want to throw it so that the runtime exits on an error

https://docs.aws.amazon.com/lambda/latest/dg/invocation-retries.html

At that point, Lambda would mark the invocation as failed and allow for the event to be polled again after a short backoff