Skip to content

Commit abf2bc3

Browse files
author
Adam Sussman
authored
AWS Lambda integration fails to detect the aws-lambda-ric 1.0 bootstrap (getsentry#976)
1 parent de54b4f commit abf2bc3

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

sentry_sdk/integrations/aws_lambda.py

+6
Original file line numberDiff line numberDiff line change
@@ -290,10 +290,16 @@ def get_lambda_bootstrap():
290290
# sys.modules['__main__'].__file__ == sys.modules['bootstrap'].__file__
291291
# sys.modules['__main__'] is not sys.modules['bootstrap']
292292
#
293+
# On container builds using the `aws-lambda-python-runtime-interface-client`
294+
# (awslamdaric) module, bootstrap is located in sys.modules['__main__'].bootstrap
295+
#
293296
# Such a setup would then make all monkeypatches useless.
294297
if "bootstrap" in sys.modules:
295298
return sys.modules["bootstrap"]
296299
elif "__main__" in sys.modules:
300+
if hasattr(sys.modules["__main__"], "bootstrap"):
301+
# awslambdaric python module in container builds
302+
return sys.modules["__main__"].bootstrap # type: ignore
297303
return sys.modules["__main__"]
298304
else:
299305
return None

0 commit comments

Comments
 (0)