Tutorials References Exercises Videos Menu
Create Website Get Certified Upgrade

AWS Serverless Error Handling for Synchronous and Asynchronous Events


Error Handling for Synchronous and Asynchronous Events

There are two sorts of errors that can happen when you call a function:

  • Function errors
  • Call errors

Function error happens when Lambda correctly passes an event to your function, but the function throws an error before finishing.

A call error happens when the request is refused before it is received by your function.

An example of a call error could be an excessive payload or a lack of permissions.


Error Handling for Synchronous Events

There are no built-in retries in a synchronous call.

Error handling must be handled by you.

All forms of errors and retries should be handled.

An example of a synchronous event is a call between API Gateway and Lambda.


Error Handling for Asynchronous Events

Lambda has built-in retry features for asynchronous event sources like Amazon S3.

When Lambda receives an asynchronous event, it responds with a "success".

Then, it sends call requests to your function from a queue.

By default, Lambda retries the call request two more times if it returns function errors.

This retry value can be set between 0 and 2.

Lambda retries the call request for up to 6 hours if it returns call errors.

The call is also known as a function call.


Error Handling for Synchronous and Asynchronous Events Video

W3schools.com collaborates with Amazon Web Services to deliver digital training content to our students.


AWS Serverless Exercises

Test Yourself With Exercises

Exercise:

What are two types of errors when you call a function?

1.  error
2.  error

Start the Exercise