When using AWS Elastic Load Balancer with Target Groups that point to Lambda functions, the event payload slightly differs from API Gateway in that API Gateway appears to automatically decode URL query parameters, whereas AWS ELB does not automatically decode URL query parameters.
We fix this by checking if requestContext.elb exists, and if so, we decode the URL query parameters to normalize it the same way that API Gateway does.
When using AWS Elastic Load Balancer with Target Groups that point to Lambda functions, the event payload slightly differs from API Gateway in that API Gateway appears to automatically decode URL query parameters, whereas AWS ELB does not automatically decode URL query parameters.
We fix this by checking if
requestContext.elb
exists, and if so, we decode the URL query parameters to normalize it the same way that API Gateway does.