fix(templates): Pin playwright to base image version in uv Dockerfile template#1904
Open
vdusek wants to merge 1 commit into
Open
fix(templates): Pin playwright to base image version in uv Dockerfile template#1904vdusek wants to merge 1 commit into
uv Dockerfile template#1904vdusek wants to merge 1 commit into
Conversation
The uv branch previously kept whatever playwright version happened to be in the env after `uv sync`, which can drift from the version baked into the Apify base image — so the actor would look for a Chromium build that `/pw-browsers/` doesn't ship. Snapshot the base image's playwright version before `COPY`/`uv sync` and pin to it afterwards (mirroring the existing sed-rewrite the pip and poetry branches use).
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1904 +/- ##
==========================================
+ Coverage 92.86% 92.89% +0.02%
==========================================
Files 167 167
Lines 11709 11709
==========================================
+ Hits 10874 10877 +3
+ Misses 835 832 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
uv Dockerfile templateuv Dockerfile template
janbuchar
reviewed
May 19, 2026
| echo "Playwright $PLAYWRIGHT_BASE_VERSION pre-installed in base image; excluding from uv sync" \ | ||
| && uv sync --frozen --no-install-project --no-editable -q --no-dev --inexact --no-install-package playwright \ | ||
| && CURRENT_PLAYWRIGHT_VERSION=$(playwright --version 2>/dev/null | cut -d ' ' -f 2) \ | ||
| && if [ "$CURRENT_PLAYWRIGHT_VERSION" != "$PLAYWRIGHT_BASE_VERSION" ]; then \ |
Collaborator
There was a problem hiding this comment.
If we do this check every time, what is the point of the --no-install-package playwright? It looks like a belt-and-suspenders thing to me.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
uvpackage-manager branch of the actor Dockerfile template (src/crawlee/project_template/{{cookiecutter.project_name}}/Dockerfile) doesn't pin Pythonplaywrightto the version pre-installed in the Apify base image. When the lockfile resolves to a differentplaywrightversion than the base image (currently 1.59.0 vs the base image's 1.60.0 + chromium-1223), the actor tries to launch a Chromium build that/pw-browsers/doesn't ship and fails withExecutable doesn't exist at /pw-browsers/chromium_headless_shell-1217/....The pip and poetry branches solve this by sed-rewriting
playwright==X.Y.Zto whateverplaywright --versionreports in the image. The uv branch's--no-install-package playwrightwas supposed to be the equivalent, but the test'spip install crawlee --force-reinstall(and any user step that touches playwright before theuv syncruns) defeats it.This fix mirrors the pip/poetry intent for uv:
playwright --versionin the earlypip install uvlayer, beforeCOPY pyproject.toml uv.lock ./or any test-injected step can mutate it.uv sync ... --no-install-package playwright, check if the env's playwright still matches; if it has drifted, force-reinstall withuv pip install --reinstall --no-deps "playwright==<base-version>".Resolves the 9 failing
uv-variant scheduled e2e jobs in run 26082797876 (playwright,adaptive_beautifulsoup,adaptive_parsel× {httpx, curl_impersonate, impit}).Verified against the live
apify/actor-python-playwright:3.13image:pip freeze | grep playwrightcheck is brittle