Posts

Showing posts from May, 2022

Handle errors in Amazon API Gateway from integrated Lambda functions

Image
In this blog, I am going to show how your API Gateway REST API behaves whenever a Lambda function which is integrated to it, returns an error. You will also learn how to handle those errors by mapping them to a corresponding HTTP status code as per your business requirement and use case. Types of Lambda Integration Before going ahead with the demo or setup, I would like to tell you about the two types of Lambda integration supported in API Gateway. Proxy integration  - The client sends a request to the API Gateway which acts as a proxy server, sends the entire request to its backend Lambda function. The integration method should be set as HTTP POST with the ARN of your Lambda function. Also, note that API Gateway should be granted with sufficient  permission to invoke the function. Non-proxy/Custom integration  - Here the request received and response send by the API Gateway can be customized as per the requirement of the use case using Mapping templates and Models. Handling of Lambda