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

   I have noticed an issue with the default Fernet key and error with:
   
   ### 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 width="1503" height="579" alt="Image" 
src="https://github.com/user-attachments/assets/cbc2b05d-56d6-44e1-9185-675c4192ec9e";
 />
   
   ### 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 "<string>", 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 "<string>", 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 overriding 
the fernetKey using values.yaml may be a workaround I suppose.


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