Answer: A
Synchronous invocation – Lambda includes the
FunctionError
field in the response body, with details about the error in the
X-Amz-Function-Error
header. The status code is 200 for function errors.
Event sources that aren`t stream-based – Some of these event sources are set up to invoke a Lambda function synchronously, and others invoke it asynchronously. Accordingly, exceptions are handled as follows:
Synchronous invocation – Lambda includes the
FunctionError
field in the response body, with details about the error in the
X-Amz-Function-Error
header. The status code is 200 for function errors. Lambda only returns error status codes if there is an issue with the request, function, or permissions that prevent the handler from processing the event. See Invoke Errors for details.
Asynchronous invocation – Lambda retries function errors twice. If the function doesn`t have enough capacity to handle all incoming requests, events might wait in the queue for hours or days to be sent to the function. You can configure a dead-letter queue on the function to capture events that weren`t successfully processed. For more information, see Asynchronous invocation.
Lambda manages the function`s asynchronous event queue and attempts to retry on errors. If the function returns an error, Lambda attempts to run it two more times, with a one-minute wait between the first two attempts, and two minutes between the second and third attempts. Function errors include errors returned by the function`s code and errors returned by the function`s runtime, such as timeouts.
References:
https://docs.aws.amazon.com/lambda/latest/dg/invocation-async.html
https://aws.amazon.com/about-aws/whats-new/2019/11/aws-lambda-supports-max-retry-attempts-event-age-asynchronous-invocations/
https://docs.aws.amazon.com/lambda/latest/dg/invocation-sync.html