Bug description
`
superset_init | Init Step 3/4 [Starting] -- Setting up roles and perms
superset_init |
superset_init |
superset_init | ######################################################################
superset_init |
superset_init | logging was configured successfully
superset_init | 2024-09-07 05:45:51,484:INFO:superset.utils.logging_configurator:logging was configured successfully
superset_init | 2024-09-07 05:45:51,489:INFO:root:Configured event logger of type
superset_init | /usr/local/lib/python3.10/site-packages/flask_limiter/extension.py:293: UserWarning: Using the in-memory storage for tracking rate limits as no storage was explicitly specified. This is not recommended for production use. See: https://flask-limiter.readthedocs.io#configuring-a-storage-backend for documentation about configuring the storage backend.
superset_init | warnings.warn(
superset_init | Syncing role definition
superset_init | 2024-09-07 05:45:53,788:INFO:superset.security.manager:Syncing role definition
superset_init | Syncing Admin perms
superset_init | 2024-09-07 05:45:53,813:INFO:superset.security.manager:Syncing Admin perms
superset_init | Syncing Alpha perms
superset_init | 2024-09-07 05:45:53,819:INFO:superset.security.manager:Syncing Alpha perms
superset_init | Syncing Gamma perms
superset_init | 2024-09-07 05:45:53,981:INFO:superset.security.manager:Syncing Gamma perms
superset_init | Syncing sql_lab perms
superset_init | 2024-09-07 05:45:54,141:INFO:superset.security.manager:Syncing sql_lab perms
superset_init | Fetching a set of all perms to lookup which ones are missing
superset_init | 2024-09-07 05:45:54,300:INFO:superset.security.manager:Fetching a set of all perms to lookup which ones are missing
superset_init | Creating missing datasource permissions.
superset_init | 2024-09-07 05:45:54,305:INFO:superset.security.manager:Creating missing datasource permissions.
superset_init | Creating missing database permissions.
superset_init | 2024-09-07 05:45:54,309:INFO:superset.security.manager:Creating missing database permissions.
superset_init | Loaded your LOCAL configuration at [/app/docker/pythonpath_dev/superset_config.py]
superset_init | Traceback (most recent call last):
superset_init | File "/usr/local/lib/python3.10/site-packages/sqlalchemy_utils/types/encrypted/encrypted_type.py", line 126, in decrypt
superset_init | decrypted = decrypted.decode('utf-8')
superset_init | UnicodeDecodeError: 'utf-8' codec can't decode byte 0xfe in position 0: invalid start byte
superset_init |
superset_init | During handling of the above exception, another exception occurred:
superset_init |
superset_init | Traceback (most recent call last):
superset_init | File "/usr/local/bin/superset", line 33, in
superset_init | sys.exit(load_entry_point('apache-superset', 'console_scripts', 'superset')())
superset_init | File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1130, in call
superset_init | return self.main(args, kwargs)
superset_init | File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1055, in main
superset_init | rv = self.invoke(ctx)
superset_init | File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
superset_init | return _process_result(sub_ctx.command.invoke(sub_ctx))
superset_init | File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
superset_init | return ctx.invoke(self.callback, ctx.params)
superset_init | File "/usr/local/lib/python3.10/site-packages/click/core.py", line 760, in invoke
superset_init | return __callback(args, kwargs)
superset_init | File "/usr/local/lib/python3.10/site-packages/click/decorators.py", line 26, in new_func
superset_init | return f(get_current_context(), *args, kwargs)
superset_init | File "/usr/local/lib/python3.10/site-packages/flask/cli.py", line 357, in decorator
superset_init | return __ctx.invoke(f, args, kwargs)
superset_init | File "/usr/local/lib/python3.10/site-packages/click/core.py", line 760, in invoke
superset_init | return __callback(args, kwargs)
superset_init | File "/usr/local/lib/python3.10/site-packages/click/decorators.py", line 26, in new_func
superset_init | return f(get_current_context(), *args, kwargs)
superset_init | File "/usr/local/lib/python3.10/site-packages/flask/cli.py", line 357, in decorator
superset_init | return __ctx.invoke(f, args, kwargs)
superset_init | File "/usr/local/lib/python3.10/site-packages/click/core.py", line 760, in invoke
superset_init | return __callback(args, **kwargs)
superset_init | File "/app/superset/cli/main.py", line 65, in init
superset_init | security_manager.sync_role_definitions()
superset_init | File "/app/superset/security/manager.py", line 891, in sync_role_definitions
superset_init | self.create_missing_perms()
superset_init | File "/app/superset/security/manager.py", line 844, in create_missing_perms
superset_init | databases = self.get_session.query(models.Database).all()
superset_init | File "/usr/local/lib/python3.10/site-packages/sqlalchemy/orm/query.py", line 2768, in all
superset_init | return self._iter().all()
superset_init | File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/result.py", line 1371, in all
superset_init | return self._allrows()
superset_init | File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/result.py", line 401, in _allrows
superset_init | rows = self._fetchall_impl()
superset_init | File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/result.py", line 1284, in _fetchall_impl
superset_init | return self._real_result._fetchall_impl()
superset_init | File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/result.py", line 1696, in _fetchall_impl
superset_init | return list(self.iterator)
superset_init | File "/usr/local/lib/python3.10/site-packages/sqlalchemy/orm/loading.py", line 147, in chunks
superset_init | fetch = cursor._raw_all_rows()
superset_init | File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/result.py", line 393, in _raw_all_rows
superset_init | return [make_row(row) for row in rows]
superset_init | File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/result.py", line 393, in
superset_init | return [make_row(row) for row in rows]
superset_init | File "/usr/local/lib/python3.10/site-packages/sqlalchemy/sql/type_api.py", line 1681, in process
superset_init | return process_value(impl_processor(value), dialect)
superset_init | File "/usr/local/lib/python3.10/site-packages/sqlalchemy_utils/types/encrypted/encrypted_type.py", line 479, in process_result_value
superset_init | value = super().process_result_value(value=value, dialect=dialect)
superset_init | File "/usr/local/lib/python3.10/site-packages/sqlalchemy_utils/types/encrypted/encrypted_type.py", line 424, in process_result_value
superset_init | decrypted_value = self.engine.decrypt(value)
superset_init | File "/usr/local/lib/python3.10/site-packages/sqlalchemy_utils/types/encrypted/encrypted_type.py", line 128, in decrypt
superset_init | raise ValueError('Invalid decryption key')
superset_init | ValueError: Invalid decryption key
`
How to reproduce the bug
- wget github release 4.0.2.tar.gz
- docker compose -f docker-compose-non-dev.yml up
- and log show this bug log
Screenshots/recordings
No response
Superset version
master / latest-dev
Python version
3.9
Node version
16
Browser
Chrome
Additional context
No response
Checklist
- [ ] I have searched Superset docs and Slack and didn't find a solution to my problem.
- [ ] I have searched the GitHub issue tracker and didn't find a similar bug report.
- [ ] I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.
Comment From: dosubot[bot]
Hey there, @vyouzhis! I'm here to assist with any bugs, questions, or contributions you might have regarding Superset. Let's tackle this together!
I found a similar open issue and some closed issues that might help you resolve the "Invalid decryption key" error during the superset init
process.
Similar Issues and Solutions
- Open Issue:
-
ValueError: Invalid decryption key - multiple superset instance and single database:
- Solution: Ensure that all Superset instances use the same
SECRET_KEY
in their superset_config.py
file:
python
SECRET_KEY = 'YOUR_OWN_RANDOM_GENERATED_SECRET_KEY'
- This key is used for securely signing session cookies and encrypting sensitive information stored in Superset's application metadata database [1].
-
Closed Issues:
-
After PC restart Superset won't fetch databases: Invalid decryption key:
- Solution: Use
superset re-encrypt-secrets
after changing every utf-8
string found in the file /home/YOUR_USER/superset-env/lib/pythonX.X.X/site-packages/sqlalchemy_utils/types/encrypted/encrypted_type.py
to latin-1
[2].
-
sqllab - Invalid decryption key:
- Solution: Upgrade Superset using
pip install apache-superset --upgrade
instead of pip install apache-superset
[3].
Additional Steps
Ensure that your SECRET_KEY
is correctly set in your superset_config.py
file. This key is crucial for encryption and decryption processes:
SECRET_KEY = 'your_secret_key_here'
Replace 'your_secret_key_here'
with your actual secret key. This should help resolve the "Invalid decryption key" error during the superset init
process [4].
By following these steps and ensuring the SECRET_KEY
is consistent across all instances, you should be able to resolve the issue.
To continue talking to Dosu, mention @dosu.
Comment From: vyouzhis
Hey there, @vyouzhis! I'm here to assist with any bugs, questions, or contributions you might have regarding Superset. Let's tackle this together!
I found a similar open issue and some closed issues that might help you resolve the "Invalid decryption key" error during the superset init
process.
Similar Issues and Solutions
-
Open Issue:
-
ValueError: Invalid decryption key - multiple superset instance and single database:
- Solution: Ensure that all Superset instances use the same
SECRET_KEY
in their superset_config.py
file:
python
SECRET_KEY = 'YOUR_OWN_RANDOM_GENERATED_SECRET_KEY'
- This key is used for securely signing session cookies and encrypting sensitive information stored in Superset's application metadata database [1].
- Closed Issues:
-
After PC restart Superset won't fetch databases: Invalid decryption key:
Additional Steps
Ensure that your SECRET_KEY
is correctly set in your superset_config.py
file. This key is crucial for encryption and decryption processes:
python
SECRET_KEY = 'your_secret_key_here'
Replace 'your_secret_key_here'
with your actual secret key. This should help resolve the "Invalid decryption key" error during the superset init
process [4].
By following these steps and ensuring the SECRET_KEY
is consistent across all instances, you should be able to resolve the issue.
To continue talking to Dosu, mention @dosu.
~/superset-4.0.2$ find . -type f -name "superset_config*"
./docker/pythonpath_dev/pycache/superset_config.cpython-310.pyc
./docker/pythonpath_dev/superset_config.py
./docker/pythonpath_dev/superset_config_local.example
here file : superset_config.py ?
Comment From: rusackas
Are you still facing this issue? I fear there's just not enough to go on here, so we'll need more details/steps to be able to reproduce this issue, otherwise it may be closed as stale/inactive.
Comment From: rusackas
Assuming you've resolved this or moved on, so I'll close it. Holler if there's more to deal with here.