Skip to content

symlink-related asset 404 error will be introduced under pypi installation with uv #52611

@MagicFrogSJTU

Description

@MagicFrogSJTU

Apache Airflow version

3.0.2

If "Other Airflow 2 version" selected, which one?

No response

What happened?

# Install airflow via uv
uv pip install "apache-airflow[celery]==3.0.2" --constraint "https://raw.githubusercontent.com/apache/airflow/constraints-3.0.2/constraints-3.10.txt"

# run airflow locally
airflow standalone

# when visiting the web ui, 404 is returned.
api-server | INFO:     127.0.0.1:58002 - "GET /api/v2/static/assets/index-QiQVuLYY.js HTTP/1.1" 404 Not Found

# direct curling also return 404
curl http://127.0.0.1:8080/static/assets/index-QiQVuLYY.js

What you think should happen instead?

should be 200 OK like the other installation method.

This is because uv default link-mode is link rather than copy, and StaticFiles default follow_symlink is False.

default symlink:

>> ll /mnt/cat/yzchen/code/cog_fusion/airflow/.venv/lib/python3.10/site-packages/airflow/ui/dist
total 28K
drwxrwxr-x 4 yzchen yzchen 4.0K Jul  1 11:30 ./
drwxrwxr-x 8 yzchen yzchen 4.0K Jul  1 11:30 ../
drwxrwxr-x 2 yzchen yzchen 4.0K Jul  1 11:30 assets/
lrwxrwxrwx 1 yzchen yzchen   82 Jul  1 11:30 index.html -> /home/yzchen/.cache/uv/archive-v0/D9UWS7CGfe4U_6ms45U3B/airflow/ui/dist/index.html
lrwxrwxrwx 1 yzchen yzchen   83 Jul  1 11:30 pin_100.png -> /home/yzchen/.cache/uv/archive-v0/D9UWS7CGfe4U_6ms45U3B/airflow/ui/dist/pin_100.png
lrwxrwxrwx 1 yzchen yzchen   82 Jul  1 11:30 pin_32.png -> /home/yzchen/.cache/uv/archive-v0/D9UWS7CGfe4U_6ms45U3B/airflow/ui/dist/pin_32.png
drwxrwxr-x 2 yzchen yzchen 4.0K Jul  1 11:30 .vite/

one of the airflow code that introduces the bug.

# airflow/api_fastapi/core_api/app.py
    app.mount(
        "/static",
        StaticFiles(
            directory=directory,
            html=True,
        ),
        name="webapp_static_folder",
    )

Thus,
follow_symlink=True should be added to StaticFiles().

How to reproduce

# Install airflow via uv
uv pip install "apache-airflow[celery]==3.0.2" --constraint "https://raw.githubusercontent.com/apache/airflow/constraints-3.0.2/constraints-3.10.txt"

# Install airflow via uv
airflow standalone
```bash

### Operating System

ubuntu24.04

### Versions of Apache Airflow Providers

_No response_

### Deployment

Virtualenv installation

### Deployment details

_No response_

### Anything else?

_No response_

### 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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:UIRelated to UI/UX. For Frontend Developers.area:corearea:webserverWebserver related Issueskind:bugThis is a clearly a bugneeds-triagelabel for new issues that we didn't triage yet

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions