Apache Airflow version
3.0.5
What happened?
In airflow/airflow-core/src/airflow/models/taskinstance.py
the _log_uri is constructed using base_url from the config, but the base_url value does not end with /. This causes the path to concatenate incorrectly.
Affected Code
# taskinstance.py
_log_uri = f"{base_url}dags/{self.dag_id}/runs/{run_id}/tasks/{self.task_id}{map_index}{try_number}"
# config
base_url = conf.get("api", "base_url", fallback="http://localhost:8080/")
Problem
Because base_url does not include a trailing /, the generated URI is malformed.
Example:
my_domaindags/dag1/runs/...
What you think should happen instead?
Expected Behavior
_log_uri should properly include a / between the base_url and dags/....
Example:
my_domain/dags/dag1/runs/...
Possible Fix
Ensure base_url is normalized with a trailing / when loaded from config.
Or, update _log_uri construction to explicitly add / if missing.
How to reproduce
def dag_log(context, error_message=None):
task_instance = context.get('task_instance')
emoji = context.get('params', {}).get('alert_emoji', 'bangbang')
_msg = """
:{emoji}: Airflow Failed.
Dag: {dag}
Task: {task}
Execution Time: {exec_date}
Log Url: {log_url}
""".format(
emoji=emoji,
dag=task_instance.dag_id,
task=task_instance.task_id,
exec_date=context.get('logical_date'),
log_url=task_instance.log_url
Operating System
linux
Versions of Apache Airflow Providers
We're using Astro Runtime 3.0-8
Deployment
Astronomer
Deployment details
astro dev start
Anything else?
No response
Are you willing to submit PR?
Code of Conduct
Apache Airflow version
3.0.5
What happened?
In airflow/airflow-core/src/airflow/models/taskinstance.py
the _log_uri is constructed using base_url from the config, but the base_url value does not end with /. This causes the path to concatenate incorrectly.
Problem
Because base_url does not include a trailing /, the generated URI is malformed.
Example:
my_domaindags/dag1/runs/...What you think should happen instead?
Expected Behavior
_log_uri should properly include a / between the base_url and dags/....
Example:
my_domain/dags/dag1/runs/...Possible Fix
Ensure base_url is normalized with a trailing / when loaded from config.
Or, update _log_uri construction to explicitly add / if missing.
How to reproduce
def dag_log(context, error_message=None):
task_instance = context.get('task_instance')
emoji = context.get('params', {}).get('alert_emoji', 'bangbang')
_msg = """
:{emoji}: Airflow Failed.
Dag: {dag}
Task: {task}
Execution Time: {exec_date}
Log Url: {log_url}
""".format(
emoji=emoji,
dag=task_instance.dag_id,
task=task_instance.task_id,
exec_date=context.get('logical_date'),
log_url=task_instance.log_url
Operating System
linux
Versions of Apache Airflow Providers
We're using Astro Runtime 3.0-8
Deployment
Astronomer
Deployment details
astro dev start
Anything else?
No response
Are you willing to submit PR?
Code of Conduct