dosubot[bot] commented on issue #28044: URL: https://github.com/apache/superset/issues/28044#issuecomment-2130391576
<!-- Greeting --> Hi @bmschow! I'm a bot designed to help you with bugs, questions, and contributions. I'm here to assist you while waiting for a human maintainer. <!-- Answer --> The "Fatal Error" you're encountering when clicking "Connect" in Superset's UI is likely related to the encryption and decryption of database connection parameters. The stack trace indicates an issue with the `sqlalchemy_utils.types.encrypted.encrypted_type` module, specifically a `TypeError` stating that a bytes-like object is required, not a tuple. Here are the steps to resolve this issue: 1. **Check the Encryption Key**: Ensure that the encryption key used for the `encrypted_extra` field is correctly configured and is a bytes-like object. The error suggests that a tuple might be passed instead of a bytes-like object. 2. **Validate `masked_encrypted_extra` Field**: Make sure that the `masked_encrypted_extra` field is a valid JSON string. If it contains masked credentials (e.g., `PASSWORD_MASK`), ensure that the actual credentials are provided. 3. **Update Superset Configuration**: Ensure that your Superset configuration is correctly handling the encryption and decryption of sensitive information. Here is a relevant code snippet for handling the `masked_encrypted_extra` field: ```python def rename_encrypted_extra(self: Schema, data: dict[str, Any], **kwargs: Any) -> dict[str, Any]: if "encrypted_extra" in data: data["masked_encrypted_extra"] = data.pop("encrypted_extra") return data def encrypted_extra_validator(value: str) -> str: if value: try: json.loads(value) except json.JSONDecodeError as ex: raise ValidationError([_("Field cannot be decoded by JSON. %(msg)s", msg=str(ex))]) from ex return value ``` 4. **Check Database Model**: Ensure that the `sqlalchemy_uri` and `encrypted_extra` fields in the `Database` model are correctly handled. The `sqlalchemy_uri_decrypted` property should ensure that the URI is decrypted and the password is correctly set: ```python @property def sqlalchemy_uri_decrypted(self) -> str: try: conn = make_url_safe(self.sqlalchemy_uri) except DatabaseInvalidError: return "dialect://invalid_uri" if custom_password_store: conn = conn.set(password=custom_password_store(conn)) else: conn = conn.set(password=self.password) return str(conn) ``` 5. **Review Helm Chart Configuration**: Ensure that your Helm chart configuration is correctly set up to handle database connections. Here is an example configuration for database connections: ```yaml supersetNode: connections: db_host: '{{ .Release.Name }}-postgresql' db_port: "5432" db_user: superset db_pass: superset db_name: superset ``` By following these steps, you should be able to resolve the "Fatal Error" encountered when saving database configurations in Superset <sup>[[1]](https://github.com/apache/superset/blob/master/superset/databases/schemas.py)</sup><sup>[[2]](https://github.com/apache/superset/blob/master/superset/models/core.py)</sup><sup>[[3]](https://github.com/apache/superset/blob/master/helm/superset/values.yaml)</sup>. <!-- Dosu Comment Footer --> <details open> <summary> #### Details </summary> **About Dosu** This response is meant to be useful and save you time. It is **not meant to be a precise solution**, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant. </details> *To continue the conversation, mention @dosu.* -- 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: notifications-unsubscr...@superset.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For additional commands, e-mail: notifications-h...@superset.apache.org