Upgrading to V7, Invalid token error


Issue Summary

After upgrading the DB succesfully, I changed my docker-compose file to use the Redash docker image 7.0.0.b18042 version and didn’t change any environment variable on the docker-compose file.
Since then, whenever I try to run a query I get invalid token error on the worker and no result is loaded.

Technical details:

worker_1 | [2019-03-27 14:03:04,194][PID:115][ERROR][ForkPoolWorker-14] Task redash.tasks.refresh_queries[afc90f06-9133-44a5-b473-350b82714add] raised unexpected: InvalidToken()
worker_1 | Traceback (most recent call last):
worker_1 | File “/usr/local/lib/python2.7/dist-packages/celery/app/trace.py”, line 382, in trace_task
worker_1 | R = retval = fun(*args, **kwargs)
worker_1 | File “/app/redash/worker.py”, line 64, in call
worker_1 | return TaskBase.call(self, *args, **kwargs)
worker_1 | File “/usr/local/lib/python2.7/dist-packages/celery/app/trace.py”, line 641, in protected_call
worker_1 | return self.run(*args, **kwargs)
worker_1 | File “/app/redash/tasks/queries.py”, line 176, in refresh_queries
worker_1 | elif query.data_source is None:
worker_1 | File “/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/attributes.py”, line 242, in get
worker_1 | return self.impl.get(instance_state(instance), dict_)
worker_1 | File “/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/attributes.py”, line 601, in get
worker_1 | value = self.callable_(state, passive)
worker_1 | File “/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/strategies.py”, line 631, in _load_for_state
worker_1 | session, state, primary_key_identity, passive)
worker_1 | File “”, line 1, in
worker_1 | File “/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/strategies.py”, line 724, in _emit_lazyload
worker_1 | primary_key_identity)
worker_1 | File “/usr/local/lib/python2.7/dist-packages/sqlalchemy/ext/baked.py”, line 519, in _load_on_pk_identity
worker_1 | result = list(bq.for_session(self.session).params(**params))
worker_1 | File “/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/loading.py”, line 98, in instances
worker_1 | util.raise_from_cause(err)
worker_1 | File “/usr/local/lib/python2.7/dist-packages/sqlalchemy/util/compat.py”, line 265, in raise_from_cause
worker_1 | reraise(type(exception), exception, tb=exc_tb, cause=cause)
worker_1 | File “/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/loading.py”, line 79, in instances
worker_1 | rows = [proc(row) for row in fetch]
worker_1 | File “/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/loading.py”, line 511, in _instance
worker_1 | loaded_instance, populate_existing, populators)
worker_1 | File “/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/loading.py”, line 611, in populate_full
worker_1 | dict
[key] = getter(row)
worker_1 | File “/usr/local/lib/python2.7/dist-packages/sqlalchemy/sql/type_api.py”, line 1226, in process
worker_1 | return process_value(impl_processor(value), dialect)
worker_1 | File “/app/redash/models/types.py”, line 28, in process_result_value
worker_1 | return ConfigurationContainer.from_json(super(EncryptedConfiguration, self).process_result_value(value, dialect))
worker_1 | File “/usr/local/lib/python2.7/dist-packages/sqlalchemy_utils/types/encrypted/encrypted_type.py”, line 409, in process_result_value
worker_1 | decrypted_value = self.engine.decrypt(value)
worker_1 | File “/usr/local/lib/python2.7/dist-packages/sqlalchemy_utils/types/encrypted/encrypted_type.py”, line 216, in decrypt
worker_1 | decrypted = self.fernet.decrypt(value)
worker_1 | File “/usr/local/lib/python2.7/dist-packages/cryptography/fernet.py”, line 103, in decrypt
worker_1 | raise InvalidToken
worker_1 | InvalidToken

On server:

server_1 | [2019-03-27 14:55:00,203][PID:13][INFO][metrics] method=GET path=/api/jobs/5c8ea145-aaca-4bc6-8dc3-c1b2f196acec endpoint=job status=200 content_type=application/json content_length=123 duration=0.62 query_count=2 query_duration=2.84

  • Redash Version: 7
  • Browser/OS: Chrome
  • How did you install Redash: Deployed using Docker


You need to run the migrations with the same settings you use when running Redash regularly. See this comment for more details:

1 Like


I had to set the on both server and worker services in my docker-compose file, then I did the DB upgrade.
That did the trick

1 Like