Skip to content
Closed
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
10 changes: 7 additions & 3 deletions sentry_sdk/integrations/aws_lambda.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,10 +297,14 @@ def get_lambda_bootstrap():
if "bootstrap" in sys.modules:
return sys.modules["bootstrap"]
elif "__main__" in sys.modules:
if hasattr(sys.modules["__main__"], "bootstrap"):
module = sys.modules["__main__"]
if hasattr(module, "awslambdaricmain") and hasattr(module.awslambdaricmain, "bootstrap"):
return module.awslambdaricmain.bootstrap # type: ignore
elif hasattr(module, "bootstrap"):
# awslambdaric python module in container builds
return sys.modules["__main__"].bootstrap # type: ignore
return sys.modules["__main__"]
return module.bootstrap # type: ignore

return module
else:
return None

Expand Down
2 changes: 1 addition & 1 deletion tests/integrations/aws_lambda/test_aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def lambda_client():
return get_boto_client()


@pytest.fixture(params=["python3.6", "python3.7", "python3.8", "python2.7"])
@pytest.fixture(params=["python3.6", "python3.7", "python3.8", "python3.9", "python2.7"])
def lambda_runtime(request):
return request.param

Expand Down