Skip to content

Commit 01b96b2

Browse files
committed
Fix error logging during AWS init
1 parent 3f57299 commit 01b96b2

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

sentry_sdk/integrations/aws_lambda.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,10 @@ def sentry_init_error(*args, **kwargs):
6161

6262
else:
6363
# Fall back to AWS lambdas JSON representation of the error
64-
sentry_event = _event_from_error_json(json.loads(args[1]))
64+
error_info = args[1]
65+
if isinstance(error_info, str):
66+
error_info = json.loads(error_info)
67+
sentry_event = _event_from_error_json(error_info)
6568
sentry_sdk.capture_event(sentry_event)
6669

6770
return init_error(*args, **kwargs)

tests/integrations/aws_lambda/test_aws.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -317,9 +317,6 @@ def test_handler(event, context):
317317
}
318318

319319

320-
@pytest.mark.xfail(
321-
reason="Amazon changed something (2024-10-01) and on Python 3.9+ our SDK can not capture events in the init phase of the Lambda function anymore. We need to fix this somehow."
322-
)
323320
def test_init_error(run_lambda_function, lambda_runtime):
324321
envelope_items, _ = run_lambda_function(
325322
LAMBDA_PRELUDE

0 commit comments

Comments
 (0)