File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -153,7 +153,7 @@ def parse_event_source(event: dict) -> _EventSource:
153
153
event_source = _EventSource (EventTypes .STEPFUNCTIONS )
154
154
155
155
event_record = get_first_record (event )
156
- if event_record :
156
+ if event_record and isinstance ( event_record , dict ) :
157
157
aws_event_source = event_record .get ("eventSource" ) or event_record .get (
158
158
"EventSource"
159
159
)
Original file line number Diff line number Diff line change @@ -280,6 +280,13 @@ def test_detect_lambda_function_url_domain_with_invalid_input(self):
280
280
# Test with string that would normally cause an exception when split
281
281
self .assertFalse (detect_lambda_function_url_domain ("" ))
282
282
283
+ def test_event_source_with_non_dict_event_record (self ):
284
+ # Test with event_record that's not a dictionary
285
+ event = {"Records" : "not_a_dict" }
286
+ event_source = parse_event_source (event )
287
+ # Should handle the first non-dict record gracefully and return unknown
288
+ self .assertEqual (event_source .to_string (), "unknown" )
289
+
283
290
284
291
class GetTriggerTags (unittest .TestCase ):
285
292
def test_extract_trigger_tags_api_gateway (self ):
You can’t perform that action at this time.
0 commit comments