Skip to content

Dev Container: /usr/local/bin/mx-headless-shell is a dangling symlink, so playwright-cli cannot start a browser #2052

Backlog

Description

@bartoszhetmanski

Versions: mxcli v0.35.0, Mendix 11.16.1, @playwright/cli 0.1.15 (bundled playwright-core 1.62.0-alpha-2026-06-29), headless shell build chromium_headless_shell-1229 (Chrome for Testing 150.0.7871.24), linux/amd64, Docker 29.1.3 on an Ubuntu 24.04 host, devcontainer CLI 0.91.0

Steps to reproduce

  1. mxcli new MyApp with default options, then devcontainer up --workspace-folder .
  2. In the container, start the app (mxcli run --local --detach) and run playwright-cli open http://localhost:8080

Expected

playwright-cli opens the page with the generated .playwright/cli.config.json.

Actual

Error: Daemon pid=41724: Daemon process exited with code 1
[PlaywrightError: Failed to launch chromium because executable doesn't exist at /usr/local/bin/mx-headless-shell]

The link points at an unexpanded glob:

$ readlink /usr/local/bin/mx-headless-shell
/opt/ms-playwright/chromium_headless_shell-*/chrome-linux/headless_shell
$ ls /opt/ms-playwright/chromium_headless_shell-1229/
DEPENDENCIES_VALIDATED  INSTALLATION_COMPLETE  chrome-headless-shell-linux64

Cause

The Dockerfile template (cmd/mxcli/tool_templates.go line 420) links chromium_headless_shell-*/chrome-linux/headless_shell. The headless shell that the pinned @playwright/cli 0.1.15 installs lives at chrome-headless-shell-linux64/chrome-headless-shell. The glob matches nothing, sh passes it on literally, ln -sf creates a dangling link, and the image build still succeeds.

mxcli playwright page checks are not affected: headlessShellPath() in cmd/mxcli/docker/pagecheck.go stats the link, gets an error and lets Playwright pick its own browser. Affected are playwright-cli with the generated config, and anyone following the setup in docs-site/src/tools/playwright.md or the test-app skill.

Suggested fix

Link whichever layout exists and fail the build when none does, so the next layout change breaks the image build instead of the first browser test:

    HS="$(ls "$PLAYWRIGHT_BROWSERS_PATH"/chromium_headless_shell-*/chrome-headless-shell-linux64/chrome-headless-shell \
             "$PLAYWRIGHT_BROWSERS_PATH"/chromium_headless_shell-*/chrome-linux/headless_shell 2>/dev/null | head -n1)" && \
    test -x "$HS" && \
    ln -sf "$HS" /usr/local/bin/mx-headless-shell

I ran the lookup part under sh in the container and it finds the binary. I did not rebuild the image with it, and I did not check arm64 images.

After the path is fixed: Chromium sandbox

With executablePath pointing at the real file, the launch then failed on this host with Chromium sandboxing failed!. Adding "chromiumSandbox": false to launchOptions made playwright-cli open work (it opened the app's sign-in page). The host has kernel.apparmor_restrict_unprivileged_userns = 1, which may be the reason. Not checked on other hosts. If that host setting is common, the generated config may need "chromiumSandbox": false as well.

Workaround

In .playwright/cli.config.json, set executablePath to the real file (here /opt/ms-playwright/chromium_headless_shell-1229/chrome-headless-shell-linux64/chrome-headless-shell) and, on hosts like the one above, add "chromiumSandbox": false.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions