【问题标题】:Airflow webserver gettins valueError:Samesite气流网络服务器 gettins valueError:Samesite
【发布时间】:2021-03-06 08:05:41
【问题描述】:

我在我的一个环境中使用 Anaconda 安装了 Airflow 1.10.12。

但是当我尝试按照快速入门指南(https://airflow.apache.org/docs/stable/start.html)访问 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'.

我尝试将default_airflow.cfg 文件中的cookie_samesite 变量设置为None、Lax 或Strict,但错误仍然存​​在。

我的气流环境的一些细节:

我使用conda install -c anaconda airflow 在我的工作区中安装了 Apache 气流 之后,我在 Anaconda 上创建了一个环境,并在该环境中安装了气流包。然后我打开终端并运行airflow initdbairflow webserver -p 8080。然后我去网页看到了错误。

提前感谢您的帮助。

【问题讨论】:

  • 试试pip install 'werkzeug<1.1.0'
  • 工作,谢谢。如果您不介意将此作为答案发布,那么我可以关闭此问题。祝你有美好的一天。

标签: python anaconda airflow


【解决方案1】:

werkzeug 版本改为以下:

pip install 'werkzeug<1.0.0'

对于 Airflow >=2.0.0,将配置 (airflow.cfg) [webserver] cookie_samesite 更改为使用 Lax (https://github.com/apache/airflow/blob/2.0.1/UPDATING.md#the-default-value-for-webserver-cookie_samesite-has-been-changed-to-lax)。

【讨论】:

  • 根据您在此处的提交,应该是 werkzeug&lt;1.0.0 吗? github.com/apache/airflow/pull/11872
  • 当我尝试这个答案时,我得到了一个错误apache-airflow 2.0.1 requires werkzeug&gt;=1.0.1,~=1.0, but you have werkzeug 0.16.1 which is incompatible。但是我只是忽略了它,它仍然成功降级并修复了气流问题。
  • @Selah 保留 Airflow 2.0.1 所需的 werkzeug 值,但将配置更改为使用 Lax (github.com/apache/airflow/blob/master/…)
猜你喜欢
  • 2018-06-09
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-12-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多