Issues with running DB migrations: 9.1.2 --> 20.10.1

Hey guys,

Hoping someone can help me in nailing down what might be causing the issue while running DB migrations.

I have a custom on-prem with Sentry running in Kubernetes (webserver, cron and worker) with 9.1.2 image currently. I was trying to upgrade to the newest version (20.10.1), just the webserver, for now, referring to the following link.

For running DB migrations, I run an initContainer setup in kube before deploying the webserver. As soon as the db migrations start (with command sentry db upgrade), I keeping running into this error in the dbmigrations init container itself:

00:53:23 [INFO] sentry.plugins.github: apps-not-configured
Traceback (most recent call last):
  File "/usr/local/bin/sentry", line 8, in <module>
  File "/usr/local/lib/python2.7/site-packages/sentry/runner/", line 166, in main
    cli(prog_name=get_prog(), obj={}, max_content_width=100)
  File "/usr/local/lib/python2.7/site-packages/click/", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/click/", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/site-packages/click/", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/site-packages/click/", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/site-packages/click/", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/click/", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/sentry/runner/", line 30, in inner
    return ctx.invoke(f, *args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/click/", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/click/", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/sentry/runner/commands/", line 174, in upgrade
    _upgrade(not noinput, traceback, verbosity, not no_repair, with_nodestore)
  File "/usr/local/lib/python2.7/site-packages/sentry/runner/commands/", line 121, in _upgrade
  File "/usr/local/lib/python2.7/site-packages/sentry/runner/commands/", line 93, in _migrate_from_south
    if not _has_south_history(connection):
  File "/usr/local/lib/python2.7/site-packages/sentry/runner/commands/", line 78, in _has_south_history
    cursor = connection.cursor()
  File "/usr/local/lib/python2.7/site-packages/django/db/backends/base/", line 254, in cursor
    return self._cursor()
  File "/usr/local/lib/python2.7/site-packages/sentry/db/postgres/", line 44, in inner
    return func(self, *args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/sentry/db/postgres/", line 99, in _cursor
    return super(DatabaseWrapper, self)._cursor()
  File "/usr/local/lib/python2.7/site-packages/django/db/backends/base/", line 229, in _cursor
  File "/usr/local/lib/python2.7/site-packages/django/db/backends/base/", line 213, in ensure_connection
  File "/usr/local/lib/python2.7/site-packages/django/db/", line 94, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/usr/local/lib/python2.7/site-packages/django/db/backends/base/", line 213, in ensure_connection
  File "/usr/local/lib/python2.7/site-packages/django/db/backends/base/", line 189, in connect
    self.connection = self.get_new_connection(conn_params)
  File "/usr/local/lib/python2.7/site-packages/django/db/backends/postgresql/", line 176, in get_new_connection
    connection = Database.connect(**conn_params)
  File "/usr/local/lib/python2.7/site-packages/psycopg2/", line 126, in connect
    dsn = _ext.make_dsn(dsn, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/psycopg2/", line 175, in make_dsn
django.db.utils.ProgrammingError: invalid dsn: invalid connection option "autocommit"

I have seen other issues such as this. But couldnt really do much since it was mentioned that all the related fixes had already been merged following v10 release.

Was wondering if someone can assist on this? Willing to share config files info if required. Basically i create a localized image using script and then add and config.yaml files to create a custom image to push to Amazon ECR and pull it from there to run into kube.


I think your Postgres version is not compatible with what we support. Also your setup sounds quite custom so don’t expect to get too many responses/support (as it is not common and known).


Thank you for the response. I overlooked something in the links I posted in the original question. The solution was right there (removing the autocommit statement in custom sentry.conf file)

Was able to proceed. Facing new issues, but I guess they are because the new setup needs new tools/containers to be put up like snuba, etc. Anyways thanks :+1:

1 Like