Unable to update version 10 to latest

The log always reaches this at the end when trying to update:

Creating crashes_snuba-api_1      ... done
02:29:34 [WARNING] sentry.utils.geo: settings.GEOIP_PATH_MMDB not configured.
02:29:40 [INFO] sentry.plugins.github: apps-not-configured
Operations to perform:
  Apply all migrations: admin, auth, contenttypes, jira_ac, nodestore, sentry, sessions, sites, social_auth
Running migrations:
  Applying sentry.0020_auto_20191125_1420...Traceback (most recent call last):
  File "/usr/local/bin/sentry", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/site-packages/sentry/runner/__init__.py", line 165, in main
    cli(prog_name=get_prog(), obj={}, max_content_width=100)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/sentry/runner/decorators.py", line 30, in inner
    return ctx.invoke(f, *args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/sentry/runner/commands/upgrade.py", line 168, in upgrade
    _upgrade(not noinput, traceback, verbosity, not no_repair)
  File "/usr/local/lib/python2.7/site-packages/sentry/runner/commands/upgrade.py", line 130, in _upgrade
    ignore_ghost_migrations=True,
  File "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 131, in call_command
    return command.execute(*args, **defaults)
  File "/usr/local/lib/python2.7/site-packages/django/core/management/base.py", line 330, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 204, in handle
    fake_initial=fake_initial,
  File "/usr/local/lib/python2.7/site-packages/django/db/migrations/executor.py", line 115, in migrate
    state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
  File "/usr/local/lib/python2.7/site-packages/django/db/migrations/executor.py", line 145, in _migrate_all_forwards
    state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
  File "/usr/local/lib/python2.7/site-packages/sentry/new_migrations/monkey/executor.py", line 26, in apply_migration
    state, migration, fake=fake, fake_initial=fake_initial
  File "/usr/local/lib/python2.7/site-packages/django/db/migrations/executor.py", line 244, in apply_migration
    state = migration.apply(state, schema_editor)
  File "/usr/local/lib/python2.7/site-packages/django/db/migrations/migration.py", line 129, in apply
    operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
  File "/usr/local/lib/python2.7/site-packages/django/db/migrations/operations/special.py", line 193, in database_forwards
    self.code(from_state.apps, schema_editor)
  File "/usr/local/lib/python2.7/site-packages/sentry/migrations/0020_auto_20191125_1420.py", line 22, in forwards
    backfill_group_ids(EventAttachment)
  File "/usr/local/lib/python2.7/site-packages/sentry/migrations/0020_auto_20191125_1420.py", line 17, in backfill_group_ids
    attachment.update(group_id=event.group_id)
AttributeError: 'EventAttachment' object has no attribute 'update'

Guessing is this is due to the fact we had this(SENTRY_FEATURES[‘organizations:event-attachments’] = True) on during the original setup of Sentry v10.0.0.dev something rather version and now it has a problem with it when we try to get to the latest stuff.

Do believe we got the latest sentry.conf.py from git for the update and we put that line in the new sentry.conf.py but not sure what else to try to get past this issue. Ideas?

Thank you in advance!

I’m not fully sure why this migration no longer works, my guess is due to a Django upgrade after it was originally written.

In any case, this migration is not super critical. Without it, old event attachments will not show up on the Issue Details > Attachments tab. You can just skip it and then continue the upgrade:

sentry django migrate --fake sentry 0020
sentry upgrade

The above commands will become the following in your case (since you are using our on-premise repo):

docker-compose run --rm web django migrate --fake sentry 0020

You can then run ./install.sh again to continue with the rest. I’ll still be investigating the root cause.

Submitted a potential fix here @SuperServer: fix(migrations): Fixes old EventAttachment migration failing by BYK · Pull Request #17755 · getsentry/sentry · GitHub. Feel free to follow that and giving it a try instead of skipping over this migration.

Awesome to wake up to see a fix! I’d give it a try but I’m not exactly sure how I would try/implement said fix. Quick hints on where to go/change? Thanks!

1 Like

Ohh I just realized you guys pushed that to the master branch. It gets past that error now! Thanks!

1 Like