Skip to content

Dagster webserver doesn't return symlinked script files #33851

Description

@tetsuromfw

What's the issue?

After upgrading Dagster to 1.13.4, I encountered an issue with my Dagster setup under Bazel.

Image

As shown in the image, Dagster webserver doesn't return script files so that I can see only blank page.

What did you expect to happen?

I believe this issue caused by use of Starlette's StaticFiles class introduced in b84b038.

Bazel replicates the directory structure into sandbox during the build process by creating a real folder tree but symlinking every individual file to its actual location. This behavior applies to the static frontend files bundled with the dagster-webserver library.

The Starlette router used for serving static files returns a 404 error because the default configuration for StaticFiles class does not follow symlinks.

I have also confirmed that this workaround fix the issue for me;

from dagster_webserver.webserver import DagsterWebserver
from starlette.routing import Mount
from starlette.staticfiles import StaticFiles

_build_static_routes_orig = DagsterWebserver.build_static_routes


def _build_static_routes_new(self):
    routes = _build_static_routes_orig(self)
    for route in routes:
        if isinstance(route, Mount) and isinstance(route.app, StaticFiles):
            route.app.follow_symlink = True

    return routes


DagsterWebserver.build_static_routes = _build_static_routes_new

from dagster_webserver.cli import main

if __name__ == "__main__":
    sys.exit(main())

How to reproduce?

  • Setup Dagster under Bazel
  • Or replace some static frontend files bundled with the dagster-webserver library with symlink (not tested)

Dagster version

1.13.4

Deployment type

Local

Deployment details

No response

Additional information

No response

Message from the maintainers

Impacted by this issue? Give it a 👍! We factor engagement into prioritization.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions