Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion samtranslator/model/sam_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ def _event_resources_to_link(self, resources):
try:
event_source = self.event_resolver.resolve_resource_type(event_dict).from_dict(
self.logical_id + logical_id, event_dict, logical_id)
except TypeError as e:
except (TypeError, AttributeError) as e:
raise InvalidEventException(logical_id, "{}".format(e))
event_resources[logical_id] = event_source.resources_to_link(resources)
return event_resources
Expand Down
10 changes: 10 additions & 0 deletions tests/translator/input/error_function_invalid_event_type.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,13 @@ Resources:
Method: get
Path: /

TestFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: code/
Handler: lambda_handler.handler

Runtime: python3.6
Events:
FileUploaded:

Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
"errorMessage": "Resource with id [FunctionApiTypeError] is invalid. Event with id [ApiEvent] is invalid. Resource dict has missing or invalid value for key Type. Event Type is: API. Resource with id [FunctionNoEventType] is invalid. Event with id [MissingType] is invalid. Resource dict has missing or invalid value for key Type. Event Type is: None."
}
],
"errorMessage": "Invalid Serverless Application Specification document. Number of errors found: 2. Resource with id [FunctionApiTypeError] is invalid. Event with id [ApiEvent] is invalid. Resource dict has missing or invalid value for key Type. Event Type is: API. Resource with id [FunctionNoEventType] is invalid. Event with id [MissingType] is invalid. Resource dict has missing or invalid value for key Type. Event Type is: None."
"errorMessage": "Invalid Serverless Application Specification document. Number of errors found: 3. Resource with id [FunctionApiTypeError] is invalid. Event with id [ApiEvent] is invalid. Resource dict has missing or invalid value for key Type. Event Type is: API. Resource with id [FunctionNoEventType] is invalid. Event with id [MissingType] is invalid. Resource dict has missing or invalid value for key Type. Event Type is: None. Resource with id [TestFunction] is invalid. Event with id [FileUploaded] is invalid. 'NoneType' object has no attribute 'get'"
}