Skip to content

Commit 856e5bc

Browse files
authored
fix(awslambda): aws_event can be an empty list (#2849)
1 parent 8e44430 commit 856e5bc

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

sentry_sdk/integrations/aws_lambda.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def sentry_handler(aws_event, aws_context, *args, **kwargs):
8181
# will be the same for all events in the list, since they're all hitting
8282
# the lambda in the same request.)
8383

84-
if isinstance(aws_event, list):
84+
if isinstance(aws_event, list) and len(aws_event) >= 1:
8585
request_data = aws_event[0]
8686
batch_size = len(aws_event)
8787
else:

tests/integrations/aws_lambda/test_aws.py

+1
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,7 @@ def test_handler(event, context):
489489
True,
490490
2,
491491
),
492+
(b"[]", False, 1),
492493
],
493494
)
494495
def test_non_dict_event(

0 commit comments

Comments
 (0)