The documentation on this page on the configuration page https://airflow.apache.org/configuration.html is slightly misleading
2. Generate fernet_key, using this code snippet below. fernet_key must be a base64-encoded 32-byte key.
from cryptography.fernet import Fernet fernet_key= Fernet.generate_key() print(fernet_key) # your fernet_key, keep it in secured place!
3. Replace airflow.cfg fernet_key value with the one from step 2.
The value returned in step one is something like b'K_8Yv52REP1qsa7OPupKYJe_CzngMI_KqwfM-2qAyVs='
which lead me to believe the config was suppose to be
fernet_key = b'K_8Yv52REP1qsa7OPupKYJe_CzngMI_KqwfM-2qAyVs='
When in fact it should be
fernet_key = K_8Yv52REP1qsa7OPupKYJe_CzngMI_KqwfM-2qAyVs=
I assumed the config parse needed to know it was a byte string and would handle the value correctly. After wasting 30mins I was able to figure out the solution, and probably could have arrived at it sooner had I been more familiar with python.
But I recommend changing the docs as below to avoid confusion for other new users.
from cryptography.fernet import Fernet fernet_key= Fernet.generate_key() print(fernet_key.decode()) # your fernet_key, keep it in secured place!
I'll submit a pr for this shortly.