prakass1 commented on issue #52837:
URL: https://github.com/apache/airflow/issues/52837#issuecomment-3042683998

   > I have noticed an issue with the default Fernet key and erroring when 
testing the chart:
   > 
   > ### How to Replicate:
   > * Run airflow on kubernetes:
   > 
   > ```
   > helm repo add apache-airflow-dev 
https://dist.apache.org/repos/dist/dev/airflow/helm-chart/1.18.0rc1/
   > helm repo update
   > helm install airflow apache-airflow-dev/airflow --namespace 
airflow-dev-test
   > ```
   > 
   > * port forward the api-server: `kubectl port-forward 
svc/airflow-api-server 8080:8080 --namespace airflow-dev-test` to access the UI.
   > * Add a Variable and see 500 Internal Server Error:
   > 
   > <img alt="Image" width="1503" height="579" 
src="https://private-user-images.githubusercontent.com/6094960/462961523-cbc2b05d-56d6-44e1-9185-675c4192ec9e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NTE4Mzc0NDgsIm5iZiI6MTc1MTgzNzE0OCwicGF0aCI6Ii82MDk0OTYwLzQ2Mjk2MTUyMy1jYmMyYjA1ZC01NmQ2LTQ0ZTEtOTE4NS02NzVjNDE5MmVjOWUucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDcwNiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTA3MDZUMjEyNTQ4WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9YWZlMGI4OWViMmI2N2RhMTVmMmY4MDY2ZTYwNWQxMzBlMDdkZGM0ZmMxODVjZDc1YzM0NTRiNTUzZTAxNDk5OSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.u0AB4njKmq2OVgZrnE3IJmD4XLapb_mmwbPmrfLrfr0";>
   > ### Operating System:
   > MacOS
   > 
   > ### Error Message:
   > File 
"/home/airflow/.local/lib/python3.12/site-packages/anyio/_backends/_asyncio.py",
 line 967, in run result = context.run(func, *args) ^^^^^^^^^^^^^^^^^^^^^^^^ 
File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/api_fastapi/core_api/routes/public/variables.py",
 line 187, in post_variable Variable.set(**post_body.model_dump(), 
session=session) File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/models/variable.py", 
line 235, in set session.add(Variable(key=key, val=stored_value, 
description=description)) 
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "", line 4, 
in **init** File 
"/home/airflow/.local/lib/python3.12/site-packages/sqlalchemy/orm/state.py", 
line 481, in _initialize_instance with util.safe_reraise(): ^^^^^^^^^^^^^^^^^^^ 
File 
"/home/airflow/.local/lib/python3.12/site-packages/sqlalchemy/util/langhelpers.py",
 line 70, in **exit** compat.raise_( File 
"/home/airflow/.local/lib/python3.12/site-packages/sqlalchemy/util/compat.py
 ", line 211, in raise_ raise exception File 
"/home/airflow/.local/lib/python3.12/site-packages/sqlalchemy/orm/state.py", 
line 479, in _initialize_instance return manager.original_init(*mixed[1:], 
**kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/models/variable.py", 
line 61, in **init** self.val = val ^^^^^^^^ File "", line 1, in **set** File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/models/variable.py", 
line 93, in set_val fernet = get_fernet() ^^^^^^^^^^^^ File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/models/crypto.py", 
line 90, in get_fernet raise AirflowException(f"Could not create Fernet object: 
{value_error}") airflow.exceptions.AirflowException: Could not create Fernet 
object: Fernet key must be 32 url-safe base64-encoded _bytes.___
   > 
   > Are there any solutions already thought for this?, also probably providing 
the fernetKey in the values.yaml may be a workaround I suppose.
   
   I can confirm that adding override.yaml and providing the fernetKey as per 
https://airflow.apache.org/docs/apache-airflow/stable/security/secrets/fernet.html#generating-fernet-key
 works.
   
   ```


-- 
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]

Reply via email to