question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

FlaskIntegration / AwsLambdaIntegration version 0.6.2 has incorrect url and transaction tags

See original GitHub issue

_Originally posted by @untitaker in https://github.com/getsentry/sentry-python/issues/190#issuecomment-446722477_

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 https://github.com/Miserlou/Zappa/issues/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()

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
iteratelancecommented, Dec 20, 2018

@untitaker, yes release 0.6.4 seems to resolve issues for us. Thanks

0reactions
untitakercommented, Dec 29, 2018

@iteratelance yes I believe that setting the transaction to random user input is not great (and since this is a 404 the raw URL would be truly arbitrary).

Read more comments on GitHub >

github_iconTop Results From Across the Web

AWS Flask / Lambda Integration - AssertionError: popped ...
The transaction tag is actually being named the name of our Lambda function and the url is another route in our application.
Read more >
sentry Changelog - PyUp.io
Flask integration : Fix a bug that prevented custom tags from being attached to ... 0.6.2. - Fix crash in AWS Lambda integration...
Read more >
AWS Lambda | Sentry Documentation
Create a deployment package on your local machine and install the required dependencies in the deployment package. For more information, see AWS Lambda ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found