Skip to content

FlaskIntegration / AwsLambdaIntegration version 0.6.2 has incorrect url and transaction tags #200

Description

@iteratelance

Originally posted by @untitaker in #190 (comment)

After upgrading to 0.6.2 tags in our event stream are not accurate. Specifically the url and transaction tag.

For example if an exception occurs at http://www.example.com/path/1234 the url tag in our stream is showing as http://www.example.com. Furthermore the transaction tag, which we expect to be /path/1234 is registering as the name of our AWS lambda function.

We instantiate the SDK as follows:

sentry_sdk.init(
    dsn=os.environ.get('SENTRY_DSN'),
    environment=os.environ.get('FLASK_ENV', 'development'),
    integrations=[FlaskIntegration(transaction_style='url'), AwsLambdaIntegration()]
)

Reverting to 0.5.5 solves the issue, I have not tried to apply the Zappa patch Miserlou/Zappa#1723

It might be worth mentioning that we initialize the SDK in a common __init__.py file and import the sentry_sdk file in files that require it. Perhaps when sentry is initially created it is yet to know about the flask app?

__init__.py

sentry_sdk.init(
    dsn=os.environ.get('SENTRY_DSN'),
    environment=os.environ.get('FLASK_ENV', 'development'),
    integrations=[FlaskIntegration(transaction_style='url'), AwsLambdaIntegration()]
)

def create_app(name, config=None):
    pass

someapp.py

from apps import create_app
import sentry_sdk

app = create_app(__name__)

def exception_handler(e, event, context):
    sentry_sdk.capture_exception()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions