AlexisNeiraSonos opened a new issue, #54811:
URL: https://github.com/apache/airflow/issues/54811
### Apache Airflow version
3.0.5
### If "Other Airflow 2 version" selected, which one?
_No response_
### 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?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [x] I agree to follow this project's [Code of
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]