Issues are not shown in Sentry 9.0.0 with Flask

Hi everyone!

I’ve have been integrating my Flask API in Sentry 9.0.0 following the tutorial. In my general_config.py file I’ve add the following:

        SENTRY_CONFIG = {
        'dsn': 'https://615cde54678a406f927e8af8e04768fa@sentry.bi4dev.com/2',
        'dsn_public': 'https://615cde54678a406f927e8af8e04768fa@sentry.bi4dev.com/2',
        'environment': SERVER_ENV,
        'release': RELEASE,
        'auto_log_stacks': True,
    }

    sentry_sdk.init("https://615cde54678a406f927e8af8e04768fa@sentry.bi4dev.com/2")

and in my app,py file I’ve added the following:

        app.config['SENTRY_CONFIG']=SENTRY_CONFIG
        Sentry(app)

When a exception is produced arrives to the Sentry but it’s not shown in the traceback list. I have done two screenshots in order to you can see it.

Sentry receives the exception but it isn’t showed. I’ve been searching information by internet but I don’t know if the problem is in my app or in the Sentry version.

Can anyone help me with this?

Thanks!!

The second screenshot is:

As a new user I can’t upload two images in the same post jajajja

Hello Juan,

Which tutorial have you been following? Your code mixes both initialization code from the sentry_sdk package and the raven package, so it’s unclear to me.

I’ve followed the flask tutorial of Sentry Page but this tutorial doesn’t work for me so I watched the code of other project and I did it. The exception arrives to Sentry but these are not showed.
This is the tutorial:

!

Okay, the problem now is that you have two versions of our SDKs installed. Please run pip uninstall raven, delete all the sentry related setup code and follow https://docs.sentry.io/platforms/python/flask/ to set it up.

I’ve followed the tutorial and removed all about Sentry before to do it and I have the same problem. The exception arrives to Sentry but I can’t see it. It’s strage because when I create a project I have the choice to watch a example exception but I can’t watch it either. I don’t know what I have to do.

Thanks!

Can you paste a link here? I can take a look. Or is this your self-hosted version of Sentry?

Sorry, what do you mean? What link do you want?

Ah sorry, if you’re on Sentry.io you could post a link to the issue in the Sentry UI (the ZeroDivisionError) so I can debug it. On self-hosted Sentry it’s trickier. Maybe you find something in the dev console?

Sorry, I can’t give you the link because we have intalled Sentry in our server. I’ve tried to do it but the link can’t open in a external device so do you know why I can’t watch the event? Can I do some more?

Finally I could fix it :muscle: @untitaker

Cheking the log I watched the following error:

postgres_1   | ERROR:  duplicate key value violates unique constraint`
"sentry_environmentproject_project_id_29250c1307d3722b_uniq"
postgres_1   | DETAIL:  Key (project_id, environment_id)=(1, 1) already exists.
postgres_1   | STATEMENT:  INSERT INTO "sentry_environmentproject" ("project_id",`
"environment_id", "is_hidden") VALUES (1, 1, NULL) RETURNING
"sentry_environmentproject"."id"
postgres_1   | ERROR:  relation "nodestore_node" does not exist at character 8
postgres_1   | STATEMENT:  UPDATE "nodestore_node" SET "timestamp" = '2019-04-09
13:02:43.001727+00:00', "data" =
'eJztfXtz2zYW7//+FLzu7FhpHJkkSJDwxJ02idu466ZtnDa...

I though about deleting the project and creating it again and doing this I can see the issue on Sentry. In spite of Sentry works fine now I have the same first error which I have shown you before:

postgres_1   | ERROR:  duplicate key value violates unique constraint 
"sentry_environmentproject_project_id_29250c1307d3722b_uniq"
postgres_1   | DETAIL:  Key (project_id, environment_id)=(6, 2) already exists.
postgres_1   | STATEMENT:  INSERT INTO "sentry_environmentproject" ("project_id", 
"environment_id", "is_hidden") VALUES (6, 2, NULL) RETURNING 
"sentry_environmentproject"."id"

I send the error in the case that you want watch if there is any bug on the Sentry Code.

Thanks a lot for everything!!

1 Like