Trying to migrate from one server to another, and I'm having some troubles. I want to sentry import a successfully exported file. However, doing this with a fresh postgres DB whines about tables not being there, but after sentry upgrade, it won't import it because it would overwrite the sentry project. Not sure how to proceed, or if this is even a reasonable place to ask this question...
@dts you could truncate the tables, but we likely need to resolve this by giving the abiliy to overwrite data w/ import
I'd rather have an option "don't overwrite existing things but keep on truckin'". Both would be useful. How do you recommend truncating the tables? Is there some description of what I can do inside sentry shell or sentry django shell?
@dts you can truncate tables via normal SQL. Its likely you simply only need to remove the project.
Unfortunately, this strategy did not work. I was able to get it kinda working by changing the private/public keys using SQL, but now it accepts events but I cannot look at the events' details... it's claiming a 404. I'm just going to have to redeploy the app with a new DSN.
If you're getting a 404 it sounds like membership or URLs are wrong, or the event does not exist in the new system. DSN being different shouldn't affect anything as all it is for is saying "the HTTP server is here, and this is my API key".
Running into this issue as well, I'm trying to migrate from raw aws instances into kubernetes. I'd like to simply dump users and projects leaving exception history behind, but import is throwing exceptions. I've been able to get it partially working by excluding almost every model except the projects, but i'm not sure if this is going to cause problems later.
sentry --config /etc/sentry export --exclude savedsearch,rule,permission,migrationhistory,contenttype,option,site,userip,useroption,projectoption,counter,organizationmemberteam,organizationmember,team,organizationoption,projectteam,authenticator,organization,projectbookmark
It looks like cleaning history and using pg_dump is the best option but there's a lot of cruft I'd like to leave behind.
Same issue here. I'm migrating sentry from sqlite to postgres. After doing upgrade to init the database structure and then doing import, sentry complains with messages such as:
django.db.utils.IntegrityError: IntegrityError('duplicate key value violates unique constraint "django_content_type_app_label_model_key"\nDETAIL: Key (app_label, model)=(sentry, projectdsymfile) already exists.\n',)
SQL: UPDATE "django_content_type" SET "name" = %s, "app_label" = %s, "model" = %s WHERE "django_content_type"."id" = %s
I tried to also truncate table "django_content_type" prior to export but I still receive this same error even after truncating. I only care about migrating users & projects (too costly to onboard it again and change configs on already deployed live projects) and would be fine to start with events from scratch.
Importing the file to migrate projects and users proved to be very error-prone. Had to manually edit it multiple times to remove irrelevant objects which caused conflicts. But even after "successful" import, there were a lot of problems on saving various settings. For example, when changing user's role:
IntegrityError: IntegrityError('duplicate key value violates unique constraint "sentry_organizationmember_teams_pkey"\nDETAIL: Key (id)=(1) already exists.\n',)
SQL: INSERT INTO "sentry_organizationmember_teams" ("team_id", "organizationmember_id", "is_active") VALUES (%s, %s, %s), (%s, %s, %s)
Similar errors for other changes. To fix the issue in case of postgresql storage, do the following:
Generate sql commands to reset sequence numbers:
sentry django sqlsequencereset sentry > sentry_pkfix.psql
Execute them via psql:
psql -d sentry -U <sentry_user> -f sentry_pkfix.psql
Maybe it should be included in sentry repair...
I'm having this issue too, is there any updates or workaround ?
Same issue here.
Most helpful comment
I'm having this issue too, is there any updates or workaround ?