diff --git a/chalice/config.py b/chalice/config.py index dbd5dce04..f27d79d12 100644 --- a/chalice/config.py +++ b/chalice/config.py @@ -163,7 +163,15 @@ def lambda_python_version(self): return 'python3.6' elif (major, minor) <= (3, 7): return 'python3.7' - return 'python3.8' + elif (major, minor) <= (3, 8): + return 'python3.8' + elif (major, minor) <= (3, 9): + return 'python3.9' + elif (major, minor) <= (3, 10): + return 'python3.10' + elif (major, minor) <= (3, 11): + return 'python3.11' + return 'python3.12' @property def layers(self): diff --git a/chalice/deploy/packager.py b/chalice/deploy/packager.py index b2ccce979..dd29f02fc 100644 --- a/chalice/deploy/packager.py +++ b/chalice/deploy/packager.py @@ -77,6 +77,10 @@ class BaseLambdaDeploymentPackager(object): 'python3.6': 'cp36m', 'python3.7': 'cp37m', 'python3.8': 'cp38', + 'python3.9': 'cp39', + 'python3.10': 'cp310', + 'python3.11': 'cp311', + 'python3.12': 'cp312', } def __init__(self, osutils, dependency_builder, ui): diff --git a/chalice/package.py b/chalice/package.py index 6d3e12a9a..dd0ed2aab 100644 --- a/chalice/package.py +++ b/chalice/package.py @@ -735,7 +735,7 @@ def _add_domain_name(self, resource, template): 'DomainName': {'Ref': 'ApiGatewayCustomDomain'}, 'RestApiId': {'Ref': 'RestAPI'}, 'BasePath': domain_name.api_mapping.mount_path, - 'Stage': resource.api_gateway_stage, + 'Stage': {'Ref': 'RestAPI.Stage'}, } } diff --git a/tests/unit/test_package.py b/tests/unit/test_package.py index fd3c89f88..0516e9ed6 100644 --- a/tests/unit/test_package.py +++ b/tests/unit/test_package.py @@ -1646,7 +1646,7 @@ def test_can_generate_custom_domain_name(self, sample_app): 'Properties': { 'DomainName': {'Ref': 'ApiGatewayCustomDomain'}, 'RestApiId': {'Ref': 'RestAPI'}, - 'Stage': config.api_gateway_stage, + 'Stage': {'Ref': 'RestAPI.Stage'}, 'BasePath': '(none)', } } @@ -1680,7 +1680,7 @@ def test_can_generate_domain_for_regional_endpoint(self, sample_app): 'Properties': { 'DomainName': {'Ref': 'ApiGatewayCustomDomain'}, 'RestApiId': {'Ref': 'RestAPI'}, - 'Stage': config.api_gateway_stage, + 'Stage': {'Ref': 'RestAPI.Stage'}, 'BasePath': '(none)', } }