Jarxinho opened a new issue, #29829:
URL: https://github.com/apache/superset/issues/29829

   ### Bug description
   
   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 <listcomp>
       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 <listcomp>
       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
   
   1. Setup single database psql
   2. Create psql user1, user2
   4. Setup first instance superset with connection string user1 with 
SECRET_KEY = 'A'
   5. 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:
   https://github.com/apache/superset/issues/8538
   Is it any known workaround to use the same database with multiple superset 
instances without 'Invalid decryption key' error?
   
   ### Checklist
   
   - [X] I have searched Superset docs and Slack and didn't find a solution to 
my problem.
   - [X] I have searched the GitHub issue tracker and didn't find a similar bug 
report.
   - [X] 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.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to