From 55a97dd12751ca91375836e88955e3668a728d12 Mon Sep 17 00:00:00 2001 From: Daniel Sotirhos Date: Mon, 15 Jul 2024 17:29:21 -0700 Subject: [PATCH] Fix: Service responses are not compressed (#6360) --- lambdas/indexer/.chalice/config.json.template.py | 1 - lambdas/service/.chalice/config.json.template.py | 1 - src/azul/terraform.py | 10 ++++++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lambdas/indexer/.chalice/config.json.template.py b/lambdas/indexer/.chalice/config.json.template.py index 6751ef223..dd77ae946 100644 --- a/lambdas/indexer/.chalice/config.json.template.py +++ b/lambdas/indexer/.chalice/config.json.template.py @@ -25,7 +25,6 @@ "manage_iam_role": False, "iam_role_arn": "${aws_iam_role.%s.arn}" % app_name, "environment_variables": config.lambda_env, - "minimum_compression_size": config.minimum_compression_size, "lambda_timeout": config.api_gateway_lambda_timeout, "lambda_memory_size": 128, **chalice.vpc_lambda_config(app_name), diff --git a/lambdas/service/.chalice/config.json.template.py b/lambdas/service/.chalice/config.json.template.py index 46747fb3d..c40dff944 100644 --- a/lambdas/service/.chalice/config.json.template.py +++ b/lambdas/service/.chalice/config.json.template.py @@ -25,7 +25,6 @@ "manage_iam_role": False, "iam_role_arn": "${aws_iam_role.%s.arn}" % app_name, "environment_variables": config.lambda_env, - "minimum_compression_size": config.minimum_compression_size, "lambda_timeout": config.api_gateway_lambda_timeout, "lambda_memory_size": 2048, **chalice.vpc_lambda_config(app_name), diff --git a/src/azul/terraform.py b/src/azul/terraform.py index 84b5fffad..99c278f5e 100644 --- a/src/azul/terraform.py +++ b/src/azul/terraform.py @@ -793,6 +793,16 @@ def tf_config(self, app_name): del deployment['lifecycle'] deployment['triggers'] = {'redeployment': deployment.pop('stage_description')} + # Instead of specifying this property in the related Terraform + # resource, using an AWS API Gateway extension to the OpenAPI + # specification lets us avoid maintaining a complicated trigger + # dependency between Terraform resources. + # + openapi_spec = json.loads(locals[app_name]) + key = 'x-amazon-apigateway-minimum-compression-size' + openapi_spec[key] = config.minimum_compression_size + locals[app_name] = json.dumps(openapi_spec) + return { 'resource': resources, 'data': data,