brouberol opened a new issue, #44685:
URL: https://github.com/apache/airflow/issues/44685
### Apache Airflow version
2.10.3
### If "Other Airflow 2 version" selected, which one?
_No response_
### What happened?
When I'm inspecting a DAG grid, by going to `/dag/<dag_id>/grid`, and I
click on a grid square representing a DAG mapped task, then an XHR call is
performed to `/api/v1/dags/<dag_id>/dagRuns/<run_id>/taskInstances/<task_id>`,
which returns a 404 with the following error:
```json
{
"detail": "Task instance is mapped, add the map_index value to the URL",
"status": 404,
"title": "Task instance not found",
"type":
"https://airflow.apache.org/docs/apache-airflow/2.10.3/stable-rest-api-ref.html#section/Errors/NotFound"
}
```
When that happens, the page turns white and empty, with a console error
linked to Axios crashing to the 404 response.

However, when performing the exact same behavior when located on URL
`/dags/<dag_id>/grid?dag_run_id=<run_id>&task_id=<task_id>` (for example by
refreshing the page after the crash) then no such XHR call is being sent, and
the task panel loads just fine.
<img width="1495" alt="Screenshot 2024-12-05 at 10 00 15"
src="https://github.com/user-attachments/assets/a3b14d94-8426-4972-ba45-5fb6df33fb9d">
### What you think should happen instead?
I'm _guessing_ that when located on `/dags/<dag_id>/grid` with no prior
query arg, the UI does not "know" that the task is itself composed of mapped
tasks, and thus is calling the wrong API path to inspect it.
### How to reproduce
Here's a screen recording of the crash.
https://github.com/user-attachments/assets/bba93885-765b-40ee-a62f-b4704bbddf9e
The webserver logs associated with the crash are
```
x.x.x.x - - [05/Dec/2024:08:58:05 +0000] "GET
/api/v1/dags/refine_to_hive_hourly/dagRuns/scheduled__2024-12-05T04:00:00+00:00/taskInstances/refine_hive_dataset.wait_for_gobblin_export/dependencies
HTTP/1.1" 404 323
"https://airflow-analytics.wikimedia.org/dags/refine_to_hive_hourly/grid?dag_run_id=scheduled__2024-12-05T04%3A00%3A00%2B00%3A00&task_id=refine_hive_dataset.wait_for_gobblin_export"
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:133.0) Gecko/20100101
Firefox/133.0"
x.x.x.x - - [05/Dec/2024:08:58:05 +0000] "GET
/api/v1/dags/refine_to_hive_hourly/tasks/refine_hive_dataset.wait_for_gobblin_export
HTTP/1.1" 200 1117
"https://airflow-analytics.wikimedia.org/dags/refine_to_hive_hourly/grid?dag_run_id=scheduled__2024-12-05T04%3A00%3A00%2B00%3A00&task_id=refine_hive_dataset.wait_for_gobblin_export"
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:133.0) Gecko/20100101
Firefox/133.0"
x.x.x.x - - [05/Dec/2024:08:58:05 +0000] "GET
/api/v1/dags/refine_to_hive_hourly/dagRuns/scheduled__2024-12-05T04:00:00+00:00/taskInstances/refine_hive_dataset.wait_for_gobblin_export
HTTP/1.1" 404 249
"https://airflow-analytics.wikimedia.org/dags/refine_to_hive_hourly/grid?dag_run_id=scheduled__2024-12-05T04%3A00%3A00%2B00%3A00&task_id=refine_hive_dataset.wait_for_gobblin_export"
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:133.0) Gecko/20100101
Firefox/133.0"
x.x.x.x - - [05/Dec/2024:08:58:06 +0000] "GET
/object/grid_data?dag_id=refine_to_hive_hourly&num_runs=25 HTTP/1.1" 200 105027
"https://airflow-analytics.wikimedia.org/dags/refine_to_hive_hourly/grid?dag_run_id=scheduled__2024-12-05T04%3A00%3A00%2B00%3A00&task_id=refine_hive_dataset.wait_for_gobblin_export"
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:133.0) Gecko/20100101
Firefox/133.0"
x.x.x.x - - [05/Dec/2024:08:58:06 +0000] "GET
/api/v1/dags/refine_to_hive_hourly/dagRuns/scheduled__2024-12-05T04:00:00+00:00/taskInstances/refine_hive_dataset.wait_for_gobblin_export/dependencies
HTTP/1.1" 404 323
"https://airflow-analytics.wikimedia.org/dags/refine_to_hive_hourly/grid?dag_run_id=scheduled__2024-12-05T04%3A00%3A00%2B00%3A00&task_id=refine_hive_dataset.wait_for_gobblin_export"
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:133.0) Gecko/20100101
Firefox/133.0"
x.x.x.x - - [05/Dec/2024:08:58:06 +0000] "GET
/api/v1/dags/refine_to_hive_hourly/dagRuns/scheduled__2024-12-05T04:00:00+00:00/taskInstances/refine_hive_dataset.wait_for_gobblin_export
HTTP/1.1" 404 249
"https://airflow-analytics.wikimedia.org/dags/refine_to_hive_hourly/grid?dag_run_id=scheduled__2024-12-05T04%3A00%3A00%2B00%3A00&task_id=refine_hive_dataset.wait_for_gobblin_export"
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:133.0) Gecko/20100101
Firefox/133.0"
```
### Operating System
Debian Bullseye
### Versions of Apache Airflow Providers
```
apache-airflow-providers-amazon==9.0.0
apache-airflow-providers-apache-hdfs==4.6.0
apache-airflow-providers-apache-hive==8.2.0
apache-airflow-providers-apache-spark==4.8.1
apache-airflow-providers-cncf-kubernetes==9.0.1
apache-airflow-providers-common-compat==1.2.1
apache-airflow-providers-common-io==1.4.2
apache-airflow-providers-common-sql==1.19.0
apache-airflow-providers-fab==1.5.0
apache-airflow-providers-ftp==3.11.1
apache-airflow-providers-http==4.13.2
apache-airflow-providers-imap==3.7.0
apache-airflow-providers-postgres==5.13.1
apache-airflow-providers-smtp==1.8.0
apache-airflow-providers-sqlite==3.9.0
```
### Deployment
Other
### Deployment details
We're seeing this bug with 2 types of deployments:
- airflow components running as systemd services on VMs/physical hosts
- airflow components running as Kubernetes Pods, deployed via a custom chart
### Anything else?
This bug is reproducible every time. There does not seem to be a random
element to ot.
### Are you willing to submit PR?
- [X] 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]