lamedh-dev / aws-lambda-rust-runtime

Apache License 2.0
85 stars 13 forks source link

Broken ALB lambda integration #25

Closed Mdrbhatti closed 2 years ago

Mdrbhatti commented 3 years ago

It's possible that the ALB Target group does not send multiValueHeaders attribute to a lambda depending on how the target group is configured. The official aws-lambda-rust-runtime handles this correctly by setting a default value if the attributes are missing (see https://github.com/awslabs/aws-lambda-rust-runtime/blob/master/lambda-http/src/request.rs#L55).

Since this crate depends on the aws-lambda-events crate where there is no default value set for the above attribute (https://github.com/LegNeato/aws-lambda-events/blob/master/aws_lambda_events/src/generated/alb.rs#L27), it's not possible to use the ALB lambda integration. (also related to this: https://github.com/LegNeato/aws-lambda-events/issues/36, https://github.com/aslamplr/warp_lambda/issues/10)

This is the error response: when receiving events from the ALB target group thread 'main' panicked at 'An error occured: Unexpected(Error("data did not match any variant of untagged enum LambdaRequest", line: 0, column: 0))', src/main.rs:33:10