Contents
Спойлер
Данная ошибка ValueError or Unexpected error: Invalid decryption key возникает из-за отсутствия параметра SECRET_KEY
в конфигурационном файле superset_config.py
Решение описано в github issue: Change SECRET_KEY and get error ValueError: Invalid decryption key on K8s #8538
Примерный алгоритм решения:
1 2 3 4 5 6 7 |
1. Change SECRET_KEY on superset_config.py 2. Access psql client and connect to the superset DB (\connect db_name;) 3. run update dbs set password = null, encrypted_extra = null; in the superset database (sets the secrets to blank, DB will not connect) 4. superset db upgrade 5. superset init 6. superset run 7. Update password on Superset: Data > Databases |
Вспомогательная инфа
Upgrade Apache Superset with Docker-Compose
From superset 1.3.2 to 2.0.0
Install superset 1.3.2
1 |
sudo docker-compose -f docker-compose-non-dev.yml up |
1 |
sudo docker-compose -f docker-compose-non-dev.yml up |
Warnings and Errors in console
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
1. # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect. 2. Init Step 1/4 [Starting] -- Applying DB migrations WARNING A Default SECRET_KEY was detected, please use superset_config.py to override it. Use a strong complex alphanumeric string and use a tool to help you generate a sufficiently random sequence, ex: openssl rand -base64 42 3. Falling back to the built-in cache, that stores data in the metadata database, for the following cache: `FILTER_STATE_CACHE_CONFIG`. It is recommended to use `RedisCache`, `MemcachedCache` or another dedicated caching backend for production deployments WARNING:superset.utils.cache_manager:Falling back to the built-in cache, that stores data in the metadata database, for the following cache: `FILTER_STATE_CACHE_CONFIG`. It is recommended to use `RedisCache`, `MemcachedCache` or another dedicated caching backend for production deployments 4. WARNING/MainProcess] Please run `celery upgrade settings path/to/settings.py` to avoid these warnings and to allow a smoother upgrade to Celery 6.0. 5. Init Step 2/4 [Starting] -- Setting up admin user ( admin / admin ) Error! User already exists admin 6. Init Step 3/4 [Starting] -- Setting up roles and perms UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb1 in position 0: invalid start byte During handling of the above exception, another exception occurred: File "/usr/local/lib/python3.8/site-packages/sqlalchemy_utils/types/encrypted/encrypted_type.py", line 130, in decrypt raise ValueError('Invalid decryption key') ValueError: Invalid decryption key superset_init exited with code 1 |
Warnings and Errors in UI Superset
Error loading chart datasources. Filters may not work correctly.
Unexpected error: Invalid decryption key
Возможные пути решения
- Superset 0.39 => 1.3.0 upgrade fails with ValueError: Invalid decryption key #17059
- Change SECRET_KEY and get error ValueError: Invalid decryption key on K8s #8538
- [Question] What is SECRET_KEY used in superset for?
- Cannot edit DBs («An error occurred while fetching databases»)
config[«DB_SECRET_KEY»] replace config[«SECRET_KEY»]
Чтобы избежать этой ошибки, нужно правильно сконфигурировать Apache Superset
из configuring superset
https://superset.apache.org/docs/installation/configuring-superset/
или
https://github.com/apache/superset/blob/master/docs/docs/installation/configuring-superset.mdx
в файл superset_config.py
нужно сгенерировать SECRET_KEY
1 2 3 4 5 6 7 |
# Flask App Builder configuration # Your App secret key will be used for securely signing the session cookie # and encrypting sensitive information on the database # Make sure you are changing this key for your deployment with a strong key. # You can generate a strong key using `openssl rand -base64 42` SECRET_KEY = 'YOUR_OWN_RANDOM_GENERATED_SECRET_KEY' |
Leave a Reply