Skip to content

Commit 568666e

Browse files
author
Chris Rehn
committed
Return gracefully
1 parent 6a8912e commit 568666e

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

samtranslator/model/lambda_.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class LambdaAlias(Resource):
5252
"ProvisionedConcurrencyConfig": PropertyType(False, is_type(dict)),
5353
}
5454

55-
runtime_attrs = {"arn": lambda self: fnGetAtt(self.logical_id, "Arn")}
55+
runtime_attrs = {"arn": lambda self: ref(self.logical_id)}
5656

5757

5858
class LambdaEventSourceMapping(Resource):

samtranslator/open_api/open_api.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,14 @@ def get_integration_function_logical_id(self, path_name, method_name):
101101

102102
# Extract lambda integration (${LambdaName.Arn}) and split ".Arn" off from it
103103
regex = "([A-Za-z0-9]+\.Arn)"
104-
match = re.findall(regex, arn)[0].split(".Arn")[0]
104+
matches = re.findall(regex, arn)
105+
# For Functions with AutoPublishAlias the integration URI will contain
106+
# ${LambdaName}, not ${LambdaName.Arn} (both resolve to the AWS::Lambda::Alias ARN).
107+
# Without the .Arn suffix, parsing the URI is more ambiguous, so instead of
108+
# introducing more brittle hacks, return gracefully.
109+
if not matches:
110+
return False
111+
match = matches[0].split(".Arn")[0]
105112
return match
106113

107114
def method_has_integration(self, method):

0 commit comments

Comments
 (0)