Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Airflow webserver gettins valueError:Samesite

I installed Airflow 1.10.12 using Anaconda in one of my environments.

But when I tried to follow the Quick Start Guide (at https://airflow.apache.org/docs/stable/start.html) I got the following error after accessing http://localhost:8080/admin/

Traceback (most recent call last):
  File "/home/guilherme/anaconda3/envs/engdados/lib/python3.8/site-packages/flask/app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/guilherme/anaconda3/envs/engdados/lib/python3.8/site-packages/flask/app.py", line 1953, in full_dispatch_request
    return self.finalize_request(rv)
  File "/home/guilherme/anaconda3/envs/engdados/lib/python3.8/site-packages/flask/app.py", line 1970, in finalize_request
    response = self.process_response(response)
  File "/home/guilherme/anaconda3/envs/engdados/lib/python3.8/site-packages/flask/app.py", line 2269, in process_response
    self.session_interface.save_session(self, ctx.session, response)
  File "/home/guilherme/anaconda3/envs/engdados/lib/python3.8/site-packages/flask/sessions.py", line 379, in save_session
    response.set_cookie(
  File "/home/guilherme/anaconda3/envs/engdados/lib/python3.8/site-packages/werkzeug/wrappers/base_response.py", line 468, in set_cookie
    dump_cookie(
  File "/home/guilherme/anaconda3/envs/engdados/lib/python3.8/site-packages/werkzeug/http.py", line 1217, in dump_cookie
    raise ValueError("SameSite must be 'Strict', 'Lax', or 'None'.")
ValueError: SameSite must be 'Strict', 'Lax', or 'None'.

I tried to set the cookie_samesite variable at the default_airflow.cfg file to either None, Lax or Strict but the error persists.

Some details of my airflow environment:

I installed Apache airflow in my workspace using the conda install -c anaconda airflow After that I create an environment on Anaconda and installed the airflow package within this environment. Then I opened the terminal and run airflow initdb and airflow webserver -p 8080. Then I went to webpage and saw the error.

Thanks in advance for any help.

like image 763
Guilherme Noronha Avatar asked Nov 23 '20 15:11

Guilherme Noronha


People also ask

How to use the same configuration across all the airflow components?

Use the same configuration across all the Airflow components. While each component does not require all, some configurations need to be same otherwise they would not work as expected. A good example for that is secret_key which should be same on the Webserver and Worker to allow Webserver to fetch logs from Worker.

How do I configure airflow to secure my webserver?

This topic describes how to configure Airflow to secure your webserver. Using Airflow in a web frame is enabled by default. To disable this (and prevent click jacking attacks) set the below: Variable values that are deemed “sensitive” based on the variable name will be masked in the UI automatically. See Masking sensitive data for more details.

How does airflow refresh the webserver workers?

When nonzero, airflow periodically refreshes webserver workers by bringing up new ones and killing old ones. Number of seconds to wait before refreshing a batch of workers. New in version 1.10.8. Was this entry helpful?

What is the base URL of my website as airflow?

The base url of your website as airflow cannot guess what domain or cname you are using. This is used in automated emails that airflow sends to point links to the right web server New in version 1.10.3. New in version 1.10.3. Default DAG view.


Video Answer


1 Answers

Bump werkzeug version to the following:

pip install 'werkzeug<1.0.0'

For Airflow >=2.0.0 change the config (airflow.cfg) [webserver] cookie_samesite to use Lax (https://github.com/apache/airflow/blob/2.0.1/UPDATING.md#the-default-value-for-webserver-cookie_samesite-has-been-changed-to-lax).

like image 137
kaxil Avatar answered Oct 28 '22 20:10

kaxil