Skip to content

DAGs log view of EmptyOperator shows confusing error Request URL missing protocol.  #34228

@VergeDX

Description

@VergeDX

Apache Airflow version

2.7.1

What happened

At airflow log view (DAG -> task -> log) of EmptyOperator, an error shows in window:

*** Could not read served logs: Request URL is missing an 'http://' or 'https://' protocol.

Full trace in console:

 webserver | [2023-09-09T09:26:47.632+0800] {file_task_handler.py:524} ERROR - Could not read served logs
 webserver | Traceback (most recent call last):
 webserver | File "/persistent/Works/apache-airflow/venv/lib/python3.10/site-packages/httpx/_transports/default.py", line 60, in map_httpcore_exceptions
 webserver | yield
 webserver | File "/persistent/Works/apache-airflow/venv/lib/python3.10/site-packages/httpx/_transports/default.py", line 218, in handle_request
 webserver | resp = self._pool.handle_request(req)
 webserver | File "/persistent/Works/apache-airflow/venv/lib/python3.10/site-packages/httpcore/_sync/connection_pool.py", line 214, in handle_request
 webserver | raise UnsupportedProtocol(
 webserver | httpcore.UnsupportedProtocol: Request URL is missing an 'http://' or 'https://' protocol.
 webserver |
 webserver | The above exception was the direct cause of the following exception:
 webserver |
 webserver | Traceback (most recent call last):
 webserver | File "/persistent/Works/apache-airflow/venv/lib/python3.10/site-packages/airflow/utils/log/file_task_handler.py", line 507, in _read_from_logs_server
 webserver | response = _fetch_logs_from_service(url, rel_path)
 webserver | File "/persistent/Works/apache-airflow/venv/lib/python3.10/site-packages/airflow/utils/log/file_task_handler.py", line 90, in _fetch_logs_from_service
 webserver | response = httpx.get(
 webserver | File "/persistent/Works/apache-airflow/venv/lib/python3.10/site-packages/httpx/_api.py", line 189, in get
 webserver | return request(
 webserver | File "/persistent/Works/apache-airflow/venv/lib/python3.10/site-packages/httpx/_api.py", line 100, in request
 webserver | return client.request(
 webserver | File "/persistent/Works/apache-airflow/venv/lib/python3.10/site-packages/httpx/_client.py", line 814, in request
 webserver | return self.send(request, auth=auth, follow_redirects=follow_redirects)
 webserver | File "/persistent/Works/apache-airflow/venv/lib/python3.10/site-packages/httpx/_client.py", line 901, in send
 webserver | response = self._send_handling_auth(
 webserver | File "/persistent/Works/apache-airflow/venv/lib/python3.10/site-packages/httpx/_client.py", line 929, in _send_handling_auth
 webserver | response = self._send_handling_redirects(
 webserver | File "/persistent/Works/apache-airflow/venv/lib/python3.10/site-packages/httpx/_client.py", line 966, in _send_handling_redirects
 webserver | response = self._send_single_request(request)
 webserver | File "/persistent/Works/apache-airflow/venv/lib/python3.10/site-packages/httpx/_client.py", line 1002, in _send_single_request
 webserver | response = transport.handle_request(request)
 webserver | File "/persistent/Works/apache-airflow/venv/lib/python3.10/site-packages/httpx/_transports/default.py", line 217, in handle_request
 webserver | with map_httpcore_exceptions():
 webserver | File "/nix/store/bc45k1n0pkrdkr3xa6w84w1xhkl1kkyp-python3-3.10.12/lib/python3.10/contextlib.py", line 153, in __exit__
 webserver | self.gen.throw(typ, value, traceback)
 webserver | File "/persistent/Works/apache-airflow/venv/lib/python3.10/site-packages/httpx/_transports/default.py", line 77, in map_httpcore_exceptions
 webserver | raise mapped_exc(message) from exc
 webserver | httpx.UnsupportedProtocol: Request URL is missing an 'http://' or 'https://' protocol.

What you think should happen instead

Old version of airflow (I tested 2.6.0), log view of EmptyOperator will show noting,
I'm not sure this behavior is documented, but It caused confusion for me at least.

How to reproduce

  1. I use python venv with whl in GitHub releases for installation.
  2. Run airflow standalone for development deploy, I also disable load_examples.
  3. Using EmptyOperator example like below, I also disable catchup of DAG:
import datetime

from airflow import DAG
from airflow.operators.empty import EmptyOperator

with DAG(
    dag_id="demo",
    start_date=datetime.datetime(2021, 1, 1),
    schedule="@daily",
    catchup=False,
):
    EmptyOperator(task_id="demo")
  1. Enable the DAG in airflow webserver, wait it for a run.
  2. Navigate to demo dag, demo task; press log view at toolbar.

Operating System

NixOS 23.05 (Stoat)

Versions of Apache Airflow Providers

apache-airflow-providers-common-sql==1.7.1
apache-airflow-providers-ftp==3.5.1
apache-airflow-providers-http==4.5.1
apache-airflow-providers-imap==3.3.1
apache-airflow-providers-sqlite==3.4.3

Deployment

Virtualenv installation

Deployment details

Our enterprise internal deployment using modified docker-compose, version 2.7.0 shows the same issue.
But our old 2.5.2 venv deployment works fine. EmptyOperator shows nothing as normal.

Anything else

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions