Skip to content

Commit 27e98f0

Browse files
authored
fix: Fail gracefully when AutoPublishAlias is an empty string (#2425)
Co-authored-by: Jacob Fuss <[email protected]>
1 parent 5a683b3 commit 27e98f0

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

samtranslator/model/sam_resources.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -878,7 +878,7 @@ def _validate_deployment_preference_and_add_update_policy(
878878
)
879879

880880
if deployment_preference_collection.get(self.logical_id).enabled:
881-
if self.AutoPublishAlias is None:
881+
if not self.AutoPublishAlias:
882882
raise InvalidResourceException(
883883
self.logical_id, "'DeploymentPreference' requires AutoPublishAlias property to be specified."
884884
)
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Resources:
2+
MinimalFunction:
3+
Type: 'AWS::Serverless::Function'
4+
Properties:
5+
CodeUri: s3://sam-demo-bucket/hello.zip
6+
Handler: hello.handler
7+
Runtime: python2.7
8+
AutoPublishAlias: ''
9+
DeploymentPreference:
10+
Type: AllAtOnce
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"errorMessage": "Invalid Serverless Application Specification document. Number of errors found: 1. Resource with id [MinimalFunction] is invalid. 'DeploymentPreference' requires AutoPublishAlias property to be specified."
3+
}

0 commit comments

Comments
 (0)