Posts

Showing posts with the label Aws Api Gateway

AWS Lambda: Clarification On Retrieving Data From Event Object

Image
Answer : Lambda is standalone service that doesn't need to be integrated with API Gateway. queryStringParameters , body , body mapping templates , all of this is specific not to Lambda, but to Lambda - API Gateway integration. If you are using Lambda with other services then the data is usually passed directly via event object and there is not much of a reason to pass it in some other way. For example, you can subscribe Lambda function to S3 bucket and use it to programatically process events such as file being uploaded to your bucket. In this case, information such as bucket name, object key, object data, metadata, ... will be passed directly via event object. And, when using Lambda with API Gateway, why would you want to use body mapping templates to pass data to your Lambda function directly via event object? Because you can reuse that function much easier for other purposes (if viable in your scenario), because your Lambda function will have much simpler interface,...

AWS Lambda Api Gateway Error "Malformed Lambda Proxy Response"

Answer : Usually, when you see Malformed Lambda proxy response , it means your response from your Lambda function doesn't match the format API Gateway is expecting, like this { "isBase64Encoded": true|false, "statusCode": httpStatusCode, "headers": { "headerName": "headerValue", ... }, "body": "..." } If you are not using Lambda proxy integration, you can login to API Gateway console and uncheck the Lambda proxy integration checkbox. Also, if you are seeing intermittent Malformed Lambda proxy response , it might mean the request to your Lambda function has been throttled by Lambda, and you need to request a concurrent execution limit increase on the Lambda function. If lambda is used as a proxy then the response format should be { "isBase64Encoded": true|false, "statusCode": httpStatusCode, "headers": { "headerName": "headerValue", ......