Env:
- Zappa running on Lambda
- This is a monorepo also using flask, but Flask is not deployed with AWS Lambda + API Gateway.
raven working fine, trying to migrate to sentry-python
Other seemingly related issues:
Code (simplified):
lib/sentry.py
import sentry_sdk
from sentry_sdk.integrations.aws_lambda import AwsLambdaIntegration
sentry_sdk.init(
config.SENTRY_DSN,
debug=True,
integrations=[AwsLambdaIntegration()],
release=config.BUILD,
)
task/health.py
from zappa.async import task
@task
def send_sentry_message(): # pragma: no cover
sentry_sdk.capture_message("Test message from lambda worker")
try:
raise ExceptionTest("Fake exception to test exception handling in lambda worker")
except Exception:
sentry_sdk.capture_exception()
When I run send_sentry_message, nothing shows up in Sentry.
raven works fine
I have a raven setup and a sentry-sdk running alongside. Messages sent by raven work fine, with the following configuration:
# in lib/sentry
from raven import Client
from raven.transport.http import HTTPTransport
from api.lib import config
client = Client(
dsn=config.SENTRY_DSN_WITH_SECRET_DEPRECATED,
processors=("raven.processors.SanitizePasswordsProcessor",),
release=config.BUILD,
raise_send_errors=True,
transport=HTTPTransport,
)
debug logs
With debug=True, the logs look like this:
START RequestId: e050849e-0ec5-11e9-a95b-13339e6cd40a Version: $LATEST
Instancing..
[INFO] 2019-01-02T19:37:56.235Z e050849e-0ec5-11e9-a95b-13339e6cd40a Detected environment to be AWS Lambda. Using synchronous HTTP transport.
[sentry] DEBUG: Setting up integrations (with default = True)
[DEBUG] 2019-01-02T19:37:56.296Z e050849e-0ec5-11e9-a95b-13339e6cd40a Setting up integrations (with default = True)
[sentry] DEBUG: Setting up previously not enabled integration aws_lambda
[DEBUG] 2019-01-02T19:37:56.330Z e050849e-0ec5-11e9-a95b-13339e6cd40a Setting up previously not enabled integration aws_lambda
[sentry] DEBUG: Setting up previously not enabled integration logging
[DEBUG] 2019-01-02T19:37:56.330Z e050849e-0ec5-11e9-a95b-13339e6cd40a Setting up previously not enabled integration logging
[sentry] DEBUG: Setting up previously not enabled integration stdlib
[DEBUG] 2019-01-02T19:37:56.330Z e050849e-0ec5-11e9-a95b-13339e6cd40a Setting up previously not enabled integration stdlib
[sentry] DEBUG: Setting up previously not enabled integration excepthook
[DEBUG] 2019-01-02T19:37:56.330Z e050849e-0ec5-11e9-a95b-13339e6cd40a Setting up previously not enabled integration excepthook
[sentry] DEBUG: Setting up previously not enabled integration dedupe
[DEBUG] 2019-01-02T19:37:56.331Z e050849e-0ec5-11e9-a95b-13339e6cd40a Setting up previously not enabled integration dedupe
[sentry] DEBUG: Setting up previously not enabled integration atexit
[DEBUG] 2019-01-02T19:37:56.331Z e050849e-0ec5-11e9-a95b-13339e6cd40a Setting up previously not enabled integration atexit
[sentry] DEBUG: Setting up previously not enabled integration modules
[DEBUG] 2019-01-02T19:37:56.331Z e050849e-0ec5-11e9-a95b-13339e6cd40a Setting up previously not enabled integration modules
[sentry] DEBUG: Setting up previously not enabled integration argv
[DEBUG] 2019-01-02T19:37:56.331Z e050849e-0ec5-11e9-a95b-13339e6cd40a Setting up previously not enabled integration argv
[sentry] DEBUG: Enabling integration aws_lambda
[DEBUG] 2019-01-02T19:37:56.331Z e050849e-0ec5-11e9-a95b-13339e6cd40a Enabling integration aws_lambda
[sentry] DEBUG: Enabling integration logging
[DEBUG] 2019-01-02T19:37:56.331Z e050849e-0ec5-11e9-a95b-13339e6cd40a Enabling integration logging
[sentry] DEBUG: Enabling integration stdlib
[DEBUG] 2019-01-02T19:37:56.331Z e050849e-0ec5-11e9-a95b-13339e6cd40a Enabling integration stdlib
[sentry] DEBUG: Enabling integration excepthook
[DEBUG] 2019-01-02T19:37:56.331Z e050849e-0ec5-11e9-a95b-13339e6cd40a Enabling integration excepthook
[sentry] DEBUG: Enabling integration dedupe
[DEBUG] 2019-01-02T19:37:56.332Z e050849e-0ec5-11e9-a95b-13339e6cd40a Enabling integration dedupe
[sentry] DEBUG: Enabling integration atexit
[DEBUG] 2019-01-02T19:37:56.332Z e050849e-0ec5-11e9-a95b-13339e6cd40a Enabling integration atexit
[sentry] DEBUG: Enabling integration modules
[DEBUG] 2019-01-02T19:37:56.332Z e050849e-0ec5-11e9-a95b-13339e6cd40a Enabling integration modules
[sentry] DEBUG: Enabling integration argv
[DEBUG] 2019-01-02T19:37:56.332Z e050849e-0ec5-11e9-a95b-13339e6cd40a Enabling integration argv
[INFO] 2019-01-02T19:37:56.351Z e050849e-0ec5-11e9-a95b-13339e6cd40a Found credentials in environment variables.
[sentry] DEBUG: Setting up integrations (with default = True)
[DEBUG] 2019-01-02T19:37:56.509Z e050849e-0ec5-11e9-a95b-13339e6cd40a Setting up integrations (with default = True)
[sentry] DEBUG: Setting up previously not enabled integration flask
[DEBUG] 2019-01-02T19:37:56.509Z e050849e-0ec5-11e9-a95b-13339e6cd40a Setting up previously not enabled integration flask
[sentry] DEBUG: Enabling integration flask
[DEBUG] 2019-01-02T19:37:56.509Z e050849e-0ec5-11e9-a95b-13339e6cd40a Enabling integration flask
[sentry] DEBUG: Enabling integration logging
[DEBUG] 2019-01-02T19:37:56.509Z e050849e-0ec5-11e9-a95b-13339e6cd40a Enabling integration logging
[sentry] DEBUG: Enabling integration stdlib
[DEBUG] 2019-01-02T19:37:56.509Z e050849e-0ec5-11e9-a95b-13339e6cd40a Enabling integration stdlib
[sentry] DEBUG: Enabling integration excepthook
[DEBUG] 2019-01-02T19:37:56.509Z e050849e-0ec5-11e9-a95b-13339e6cd40a Enabling integration excepthook
[sentry] DEBUG: Enabling integration dedupe
[DEBUG] 2019-01-02T19:37:56.510Z e050849e-0ec5-11e9-a95b-13339e6cd40a Enabling integration dedupe
[sentry] DEBUG: Enabling integration atexit
[DEBUG] 2019-01-02T19:37:56.510Z e050849e-0ec5-11e9-a95b-13339e6cd40a Enabling integration atexit
[sentry] DEBUG: Enabling integration modules
[DEBUG] 2019-01-02T19:37:56.510Z e050849e-0ec5-11e9-a95b-13339e6cd40a Enabling integration modules
[sentry] DEBUG: Enabling integration argv
[DEBUG] 2019-01-02T19:37:56.510Z e050849e-0ec5-11e9-a95b-13339e6cd40a Enabling integration argv
[INFO] 2019-01-02T19:37:56.650Z e050849e-0ec5-11e9-a95b-13339e6cd40a
{
"status": "starting",
"name": "send_sentry_message",
"event": "lambda task",
"logger": "api.task.base",
"level": "info",
"timestamp": "2019-01-02T19:37:56.649991Z"
}
[INFO] 2019-01-02T19:37:56.672Z e050849e-0ec5-11e9-a95b-13339e6cd40a
{
"status": "done",
"name": "send_sentry_message",
"event": "lambda task",
"logger": "api.task.base",
"level": "info",
"timestamp": "2019-01-02T19:37:56.672028Z"
}
Result of zappa.async.route_lambda_task:
null
END RequestId: e050849e-0ec5-11e9-a95b-13339e6cd40a
REPORT RequestId: e050849e-0ec5-11e9-a95b-13339e6cd40a Duration: 11075.88 ms Billed Duration: 11100 ms Memory Size: 512 MB Max Memory Used: 138 MB
The only thing I see is that it's activating the flask plugin even though it's not used in this context, but looking at the flask plugin code, it shouldn't impact sending the message.
Happy to dig more based on your feedback.
Env:
ravenworking fine, trying to migrate tosentry-pythonOther seemingly related issues:
Code (simplified):
lib/sentry.py
task/health.py
When I run
send_sentry_message, nothing shows up in Sentry.ravenworks fineI have a
ravensetup and asentry-sdkrunning alongside. Messages sent byravenwork fine, with the following configuration:debug logs
With
debug=True, the logs look like this:The only thing I see is that it's activating the flask plugin even though it's not used in this context, but looking at the flask plugin code, it shouldn't impact sending the message.
Happy to dig more based on your feedback.