From aa3e0acfaeee24175616411e4a0e184d82a87962 Mon Sep 17 00:00:00 2001 From: Bayu Aldi Yansyah Date: Wed, 29 Apr 2020 16:58:04 +0700 Subject: [PATCH 1/2] Fix dedupe_function_routes --- samcli/lib/providers/api_collector.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/samcli/lib/providers/api_collector.py b/samcli/lib/providers/api_collector.py index 6f1446a9df..50a6bc4fc1 100644 --- a/samcli/lib/providers/api_collector.py +++ b/samcli/lib/providers/api_collector.py @@ -158,7 +158,9 @@ def dedupe_function_routes(routes): if config: methods += config.methods sorted_methods = sorted(methods) - grouped_routes[key] = Route(function_name=route.function_name, path=route.path, methods=sorted_methods) + grouped_routes[key] = Route( + function_name=route.function_name, path=route.path, methods=sorted_methods, event_type=route.event_type + ) return list(grouped_routes.values()) def add_binary_media_types(self, logical_id, binary_media_types): From 0e5b84fc44b43db29a18c7830b66412f78045cbb Mon Sep 17 00:00:00 2001 From: Bayu Aldi Yansyah Date: Wed, 29 Apr 2020 17:16:33 +0700 Subject: [PATCH 2/2] Fix empty byte body as false --- samcli/local/apigw/local_apigw_service.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samcli/local/apigw/local_apigw_service.py b/samcli/local/apigw/local_apigw_service.py index bf67db303d..64285bab2b 100644 --- a/samcli/local/apigw/local_apigw_service.py +++ b/samcli/local/apigw/local_apigw_service.py @@ -484,7 +484,7 @@ def _construct_event_http(flask_request, port, binary_types, stage_name=None, st LOG.debug("Incoming Request seems to be binary. Base64 encoding the request data before sending to Lambda.") request_data = base64.b64encode(request_data) - if request_data: + if request_data is not None: # Flask does not parse/decode the request data. We should do it ourselves request_data = request_data.decode("utf-8")