sentry-python
sentry-python copied to clipboard
Raised exception not forwarded when debug not set to True (Python, AWS Lambda)
How do you use Sentry?
Self-hosted/on-premise
Version
0.20.3
Steps to Reproduce
I am trying to forward raised exceptions from python code which runs in AWS Lambda but it only gets sent when debug is set to True
. Are raised exceptions only supported when debug = True
when initializing sentry?
logging_integration = LoggingIntegration(level=logging.INFO, event_level=logging.ERROR)
lambda_integration = AwsLambdaIntegration(timeout_warning=True)
sentry_sdk.init( # pylint: disable=abstract-class-instantiated
dsn=dsn,
attach_stacktrace=True,
integrations=[lambda_integration, logging_integration],
traces_sample_rate=1.0,
)
try:
my_dict = {"a" : "test"}
value = my_dict["b"] # This should raise exception
except:
logging.exception("Key Does not Exists")
raise
This raised exception does not get captured in Sentry.
However, if i set debug = True
for the same code, the exception gets forwarded to sentry.
I don't want to set debug = True
explicitly as it generated lots of loglines which isn't something i would want in prod
Expected Result
Raised exception should get forwarded to sentry even if debug is not set to True.
Actual Result
Raised exception not captured in Sentry for Python version 3.8 in running in AWS Lambda
Hey @nadasaiyed
Thanks for reporting this! I will try to reproduce this and will then get back to you!
@nadasaiyed Could you please try with a newer SDK version? We've recently released 1.33.0 which includes a number of improvements to our AWS Lambda integration.
I'm having this same issue, using sentry SDK version 1.40.4
(can't go higher since I need python 3.7 support).
Errors are only reported to sentry if I call sentry_sdk.init(... debug=True)
. If I remove debug, then no errors are sent.
Hey @hartleybrody !
Are you also using the logging integration with the same settings as above are doing a logging.exception()
? If now could you please post a minimal code example on how to reproduce this? Thanks!