You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ValueError: Invalid decryption key (on second host with superset)
While enter:
Settings > Database Connections
superset is deployed on two separate hosts, with different:
SECRET_KEY,
username pass (db),
but the same host & database name
Traceback (most recent call last):
File "/app/superset/views/base.py", line 251, in wraps
return f(self, *args, **kwargs)
File "/app/superset/views/base_api.py", line 487, in get_list_headless
duration, response = time_function(super().get_list_headless, **kwargs)
File "/app/superset/utils/core.py", line 1463, in time_function
response = func(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/flask_appbuilder/api/init.py", line 1603, in get_list_headless
count, lst = self.datamodel.query(
File "/usr/local/lib/python3.10/site-packages/flask_appbuilder/models/sqla/interface.py", line 499, in query
query_results = query.all()
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/orm/query.py", line 2768, in all
return self._iter().all()
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/result.py", line 1077, in all
return self._allrows()
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/result.py", line 401, in _allrows
rows = self._fetchall_impl()
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/result.py", line 1696, in _fetchall_impl
return list(self.iterator)
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/orm/loading.py", line 147, in chunks
fetch = cursor._raw_all_rows()
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/result.py", line 393, in _raw_all_rows
return [make_row(row) for row in rows]
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/result.py", line 393, in
return [make_row(row) for row in rows]
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/sql/type_api.py", line 1681, in process
return process_value(impl_processor(value), dialect)
File "/usr/local/lib/python3.10/site-packages/sqlalchemy_utils/types/encrypted/encrypted_type.py", line 479, in process_result_value
value = super().process_result_value(value=value, dialect=dialect)
File "/usr/local/lib/python3.10/site-packages/sqlalchemy_utils/types/encrypted/encrypted_type.py", line 424, in process_result_value
decrypted_value = self.engine.decrypt(value)
File "/usr/local/lib/python3.10/site-packages/sqlalchemy_utils/types/encrypted/encrypted_type.py", line 128, in decrypt
raise ValueError('Invalid decryption key')
ValueError: Invalid decryption key
2024-08-01 14:31:27,526:ERROR:superset.views.base:Invalid decryption key
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/sqlalchemy_utils/types/encrypted/encrypted_type.py", line 126, in decrypt
decrypted = decrypted.decode('utf-8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd5 in position 1: invalid continuation byte
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/app/superset/views/base.py", line 251, in wraps
return f(self, *args, **kwargs)
File "/app/superset/views/base_api.py", line 487, in get_list_headless
duration, response = time_function(super().get_list_headless, **kwargs)
File "/app/superset/utils/core.py", line 1463, in time_function
response = func(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/flask_appbuilder/api/init.py", line 1603, in get_list_headless
count, lst = self.datamodel.query(
File "/usr/local/lib/python3.10/site-packages/flask_appbuilder/models/sqla/interface.py", line 499, in query
query_results = query.all()
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/orm/query.py", line 2768, in all
return self._iter().all()
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/result.py", line 1077, in all
return self._allrows()
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/result.py", line 401, in _allrows
rows = self._fetchall_impl()
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/result.py", line 1696, in _fetchall_impl
return list(self.iterator)
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/orm/loading.py", line 147, in chunks
fetch = cursor._raw_all_rows()
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/result.py", line 393, in _raw_all_rows
return [make_row(row) for row in rows]
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/result.py", line 393, in
return [make_row(row) for row in rows]
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/sql/type_api.py", line 1681, in process
return process_value(impl_processor(value), dialect)
File "/usr/local/lib/python3.10/site-packages/sqlalchemy_utils/types/encrypted/encrypted_type.py", line 479, in process_result_value
value = super().process_result_value(value=value, dialect=dialect)
File "/usr/local/lib/python3.10/site-packages/sqlalchemy_utils/types/encrypted/encrypted_type.py", line 424, in process_result_value
decrypted_value = self.engine.decrypt(value)
File "/usr/local/lib/python3.10/site-packages/sqlalchemy_utils/types/encrypted/encrypted_type.py", line 128, in decrypt
raise ValueError('Invalid decryption key')
ValueError: Invalid decryption key
How to reproduce the bug
Setup single database psql
Create psql user1, user2
Setup first instance superset with connection string user1 with SECRET_KEY = 'A'
Setup second instance superset with connection string user2 with SECRET_KEY = 'B'
Screenshots/recordings
No response
Superset version
master / latest-dev
Python version
3.9
Node version
16
Browser
Chrome
Additional context
according to: #8538
Is it any known workaround to use the same database with multiple superset instances without 'Invalid decryption key' error?
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.
The text was updated successfully, but these errors were encountered:
Jarxinho
changed the title
ValueError: Invalid decryption key
ValueError: Invalid decryption key - multiple superset instance and single database
Aug 1, 2024
Hey @Jarxinho! I'm here to help you with any bugs, questions, or contributions you might have. Let's dive in and resolve this issue together!
To avoid the 'Invalid decryption key' error when using the same database with multiple Superset instances, ensure that all instances use the same SECRET_KEY in their superset_config.py file:
# Set the same SECRET_KEY for all Superset instancesSECRET_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. By using the same SECRET_KEY across all instances, you can avoid the 'Invalid decryption key' error [1].
Bug description
ValueError: Invalid decryption key (on second host with superset)
While enter:
superset is deployed on two separate hosts, with different:
but the same host & database name
Traceback (most recent call last):
File "/app/superset/views/base.py", line 251, in wraps
return f(self, *args, **kwargs)
File "/app/superset/views/base_api.py", line 487, in get_list_headless
duration, response = time_function(super().get_list_headless, **kwargs)
File "/app/superset/utils/core.py", line 1463, in time_function
response = func(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/flask_appbuilder/api/init.py", line 1603, in get_list_headless
count, lst = self.datamodel.query(
File "/usr/local/lib/python3.10/site-packages/flask_appbuilder/models/sqla/interface.py", line 499, in query
query_results = query.all()
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/orm/query.py", line 2768, in all
return self._iter().all()
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/result.py", line 1077, in all
return self._allrows()
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/result.py", line 401, in _allrows
rows = self._fetchall_impl()
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/result.py", line 1696, in _fetchall_impl
return list(self.iterator)
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/orm/loading.py", line 147, in chunks
fetch = cursor._raw_all_rows()
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/result.py", line 393, in _raw_all_rows
return [make_row(row) for row in rows]
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/result.py", line 393, in
return [make_row(row) for row in rows]
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/sql/type_api.py", line 1681, in process
return process_value(impl_processor(value), dialect)
File "/usr/local/lib/python3.10/site-packages/sqlalchemy_utils/types/encrypted/encrypted_type.py", line 479, in process_result_value
value = super().process_result_value(value=value, dialect=dialect)
File "/usr/local/lib/python3.10/site-packages/sqlalchemy_utils/types/encrypted/encrypted_type.py", line 424, in process_result_value
decrypted_value = self.engine.decrypt(value)
File "/usr/local/lib/python3.10/site-packages/sqlalchemy_utils/types/encrypted/encrypted_type.py", line 128, in decrypt
raise ValueError('Invalid decryption key')
ValueError: Invalid decryption key
2024-08-01 14:31:27,526:ERROR:superset.views.base:Invalid decryption key
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/sqlalchemy_utils/types/encrypted/encrypted_type.py", line 126, in decrypt
decrypted = decrypted.decode('utf-8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd5 in position 1: invalid continuation byte
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/app/superset/views/base.py", line 251, in wraps
return f(self, *args, **kwargs)
File "/app/superset/views/base_api.py", line 487, in get_list_headless
duration, response = time_function(super().get_list_headless, **kwargs)
File "/app/superset/utils/core.py", line 1463, in time_function
response = func(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/flask_appbuilder/api/init.py", line 1603, in get_list_headless
count, lst = self.datamodel.query(
File "/usr/local/lib/python3.10/site-packages/flask_appbuilder/models/sqla/interface.py", line 499, in query
query_results = query.all()
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/orm/query.py", line 2768, in all
return self._iter().all()
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/result.py", line 1077, in all
return self._allrows()
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/result.py", line 401, in _allrows
rows = self._fetchall_impl()
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/result.py", line 1696, in _fetchall_impl
return list(self.iterator)
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/orm/loading.py", line 147, in chunks
fetch = cursor._raw_all_rows()
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/result.py", line 393, in _raw_all_rows
return [make_row(row) for row in rows]
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/result.py", line 393, in
return [make_row(row) for row in rows]
File "/usr/local/lib/python3.10/site-packages/sqlalchemy/sql/type_api.py", line 1681, in process
return process_value(impl_processor(value), dialect)
File "/usr/local/lib/python3.10/site-packages/sqlalchemy_utils/types/encrypted/encrypted_type.py", line 479, in process_result_value
value = super().process_result_value(value=value, dialect=dialect)
File "/usr/local/lib/python3.10/site-packages/sqlalchemy_utils/types/encrypted/encrypted_type.py", line 424, in process_result_value
decrypted_value = self.engine.decrypt(value)
File "/usr/local/lib/python3.10/site-packages/sqlalchemy_utils/types/encrypted/encrypted_type.py", line 128, in decrypt
raise ValueError('Invalid decryption key')
ValueError: Invalid decryption key
How to reproduce the bug
Screenshots/recordings
No response
Superset version
master / latest-dev
Python version
3.9
Node version
16
Browser
Chrome
Additional context
according to:
#8538
Is it any known workaround to use the same database with multiple superset instances without 'Invalid decryption key' error?
Checklist
The text was updated successfully, but these errors were encountered: