diff --git a/README.md b/README.md index ba39b84a7..2e3ce9ef9 100644 --- a/README.md +++ b/README.md @@ -939,6 +939,7 @@ to change Zappa's behavior. Use these at your own risk! "timeout_seconds": 30, // Maximum lifespan for the Lambda function (default 30, max 900.) "touch": true, // GET the production URL upon initial deployment (default True) "touch_path": "/", // The endpoint path to GET when checking the initial deployment (default "/") + "touch_try_count": 4, // Requests try count if requests return 504 when checking the initial deployment (default 4) "use_precompiled_packages": true, // If possible, use C-extension packages which have been pre-compiled for AWS Lambda. Default true. "vpc_config": { // Optional Virtual Private Cloud (VPC) configuration for Lambda function "SubnetIds": [ "subnet-12345678" ], // Note: not all availability zones support Lambda! diff --git a/zappa/cli.py b/zappa/cli.py index d453f3149..8c5cf8774 100755 --- a/zappa/cli.py +++ b/zappa/cli.py @@ -2718,12 +2718,13 @@ def touch_endpoint(self, endpoint_url): # ready and requests will return 504 status_code until ready. # So, if we get a 504 status code, rerun the request up to 4 times or # until we don't get a 504 error - if req.status_code == 504: + check_status_code = 504 + if req.status_code == check_status_code: i = 0 - status_code = 504 - while status_code == 504 and i <= 4: + touch_try_count = self.stage_config.get('touch_try_count', 4) + + while req.status_code == check_status_code and i <= touch_try_count: req = requests.get(endpoint_url + touch_path) - status_code = req.status_code i += 1 if req.status_code >= 500: diff --git a/zappa/core.py b/zappa/core.py index 9915f4cb1..93d728ea0 100644 --- a/zappa/core.py +++ b/zappa/core.py @@ -648,6 +648,9 @@ def splitpath(path): with zipfile.ZipFile(cached_wheel_path) as zfile: zfile.extractall(temp_project_path) + except requests.exceptions.RequestException as e: + print(e) + raise e except Exception as e: print(e) # XXX - What should we do here? @@ -2235,7 +2238,6 @@ def stack_outputs(self, name): except botocore.client.ClientError: return {} - def get_api_url(self, lambda_name, stage_name): """ Given a lambda_name and stage_name, return a valid API URL.