We’re using self hosted redash legacy setup. We upgraded it to version 7 couple of months back.
Right now, I’m trying to move the backend to dedicated rds.
I stopped all the services, took a pgdump. Then I loaded the pgdump to rds pgsql instance.
Then I created a new redash instance (for POC) using docker based ami. Updated the env details to point to the new RDS, started the services. I am able to login to the redash but can’t see the data sources.
Upon checking the docker logs, I see that ‘InvalidToken’ error appears for accessing the data sources.
[2019-07-16 12:40:51,896][PID:14][ERROR][redash] Exception on /api/data_sources [GET] Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1639, in full_dispatch_request rv = self.dispatch_request() File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1625, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args) File "/usr/local/lib/python2.7/dist-packages/flask_restful/__init__.py", line 477, in wrapper resp = resource(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/flask_login/utils.py", line 228, in decorated_view return func(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/flask/views.py", line 84, in view return self.dispatch_request(*args, **kwargs) File "/app/redash/handlers/base.py", line 31, in dispatch_request return super(BaseResource, self).dispatch_request(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/flask_restful/__init__.py", line 587, in dispatch_request resp = meth(*args, **kwargs) File "/app/redash/permissions.py", line 48, in decorated return fn(*args, **kwargs) File "/app/redash/handlers/data_sources.py", line 88, in get for ds in data_sources: File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/loading.py", line 98, in instances util.raise_from_cause(err) File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/util/compat.py", line 265, in raise_from_cause reraise(type(exception), exception, tb=exc_tb, cause=cause) File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/loading.py", line 79, in instances rows = [proc(row) for row in fetch] File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/loading.py", line 511, in _instance loaded_instance, populate_existing, populators) File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/loading.py", line 611, in _populate_full dict_[key] = getter(row) File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/sql/type_api.py", line 1226, in process return process_value(impl_processor(value), dialect) File "/app/redash/models/types.py", line 28, in process_result_value return ConfigurationContainer.from_json(super(EncryptedConfiguration, self).process_result_value(value, dialect)) File "/usr/local/lib/python2.7/dist-packages/sqlalchemy_utils/types/encrypted/encrypted_type.py", line 409, in process_result_value decrypted_value = self.engine.decrypt(value) File "/usr/local/lib/python2.7/dist-packages/sqlalchemy_utils/types/encrypted/encrypted_type.py", line 216, in decrypt decrypted = self.fernet.decrypt(value) File "/usr/local/lib/python2.7/dist-packages/cryptography/fernet.py", line 103, in decrypt raise InvalidToken InvalidToken
I went through the forum, github issues and understood that this is due to data sources configuration encryption in the redash version 7.
REDASH_COOKIE_SECRET is already configured in the existing instance. So I tried using the same
key details in the new instance, restarted the container, but still getting the same invalid token error.
I’ve spent time in redash forums from morning to an extent that I’ve been promoted to ‘trust level’
Most of the relevant issue topics are pre 7x version. The closest topic was Upgrading to V7, Invalid token error and checked the https://github.com/getredash/redash/issues/3617#issuecomment-477188592, but we already set the COOKIE_SECRET in the production instance and tried with the same in POC instance, still no luck. Looking for your inputs.
Further posts I referred for this migration:
- Redash Version: 7
- Browser/OS: firefox
- How did you install Redash: docker ami