Datasource and other API calls are failing with InvaildToken


We want to migrate from v7* to dockerized v8* self-hosted. Below are the steps we performed.

  1. Created a new vm in GCP using the prebuilt Image by referring the doc:
  2. Took the pg_dump from the existing v7* server and pushed it to the new vm with v8* created in step1
  3. We did pg_restore and got all the data into.
  4. I am able to see all the users, list of dashboards, list of queries etc.
  5. Now, I am unable to see the data sources and dashboards and queries.
  6. Upon checking the logs, I see the following error message:
[2020-02-27 15:11:29,501] ERROR in app: Exception on /api/data_sources [GET]
 Traceback (most recent call last):
   File "/usr/local/lib/python2.7/site-packages/flask/", line 1612, in full_dispatch_request
     rv = self.dispatch_request()
   File "/usr/local/lib/python2.7/site-packages/flask/", line 1598, in dispatch_request
     return self.view_functions[rule.endpoint](**req.view_args)
   File "/usr/local/lib/python2.7/site-packages/flask_restful/", line 477, in wrapper
     resp = resource(*args, **kwargs)
   File "/usr/local/lib/python2.7/site-packages/flask_login/", line 228, in decorated_view
     return func(*args, **kwargs)
   File "/usr/local/lib/python2.7/site-packages/flask/", line 84, in view
     return self.dispatch_request(*args, **kwargs)
   File "/app/redash/handlers/", line 31, in dispatch_request
     return super(BaseResource, self).dispatch_request(*args, **kwargs)
   File "/usr/local/lib/python2.7/site-packages/flask_restful/", line 587, in dispatch_request
     resp = meth(*args, **kwargs)
   File "/app/redash/", line 67, in decorated
     return fn(*args, **kwargs)
   File "/app/redash/handlers/", line 95, in get
     for ds in data_sources:
   File "/usr/local/lib/python2.7/site-packages/sqlalchemy/orm/", line 98, in instances
   File "/usr/local/lib/python2.7/site-packages/sqlalchemy/util/", line 265, in raise_from_cause
     reraise(type(exception), exception, tb=exc_tb, cause=cause)
   File "/usr/local/lib/python2.7/site-packages/sqlalchemy/orm/", line 79, in instances
     rows = [proc(row) for row in fetch]
   File "/usr/local/lib/python2.7/site-packages/sqlalchemy/orm/", line 511, in _instance
     loaded_instance, populate_existing, populators)
   File "/usr/local/lib/python2.7/site-packages/sqlalchemy/orm/", line 611, in _populate_full
     dict_[key] = getter(row)
   File "/usr/local/lib/python2.7/site-packages/sqlalchemy/sql/", line 1226, in process
     return process_value(impl_processor(value), dialect)
   File "/app/redash/models/", line 28, in process_result_value
     return ConfigurationContainer.from_json(super(EncryptedConfiguration, self).process_result_value(value, dialect))
   File "/usr/local/lib/python2.7/site-packages/sqlalchemy_utils/types/encrypted/", line 409, in 
     decrypted_value = self.engine.decrypt(value)
   File "/usr/local/lib/python2.7/site-packages/sqlalchemy_utils/types/encrypted/", line 216, in decrypt
     decrypted = self.fernet.decrypt(value)
   File "/usr/local/lib/python2.7/site-packages/cryptography/", line 75, in decrypt
     return self._decrypt_data(data, timestamp, ttl)
   File "/usr/local/lib/python2.7/site-packages/cryptography/", line 119, in _decrypt_data
   File "/usr/local/lib/python2.7/site-packages/cryptography/", line 108, in _verify_signature
     raise InvalidToken
 [2020-02-27 15:11:29,508][PID:11][INFO][metrics] method=GET path=/api/data_sources endpoint=data_sources status=500 content_type=application/json content_length=36 duration=21.21 query_count=5 query_duration=19.35

For this, we modified REDASH_COOKIE_SECRET env variable with the default key and also with the existing v7* key.

None of them worked.

This seems to be happening to most of the API calls.

Technical details:

  • Redash Version: Version: 8.0.0+b32245 (a16f551e)
  • Browser/OS: Ubuntu 18 / Chrome
  • How did you install Redash: using the preconfigured VM.

Please let us know

  1. The steps we performed are correct? or did we miss any of the steps?
  2. If it’s okay, then how to fix this API call issue.

Many Thanks.