Commit 8d902c9
authored
fix(templates): Pin playwright to base image version in
## Summary
The `uv` package-manager branch of the actor Dockerfile template
(`src/crawlee/project_template/{{cookiecutter.project_name}}/Dockerfile`)
doesn't pin Python `playwright` to the version pre-installed in the
Apify base image. When the lockfile resolves to a different `playwright`
version 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 with `Executable doesn't exist at
/pw-browsers/chromium_headless_shell-1217/...`.
The pip and poetry branches solve this by sed-rewriting
`playwright==X.Y.Z` to whatever `playwright --version` reports in the
image. The uv branch's `--no-install-package playwright` was supposed to
be the equivalent, but the test's `pip install crawlee
--force-reinstall` (and any user step that touches playwright before the
`uv sync` runs) defeats it.
This fix mirrors the pip/poetry intent for uv:
- **Snapshot** the base image's `playwright --version` in the early `pip
install uv` layer, before `COPY pyproject.toml uv.lock ./` or any
test-injected step can mutate it.
- After `uv sync ... --no-install-package playwright`, check if the
env's playwright still matches; if it has drifted, force-reinstall with
`uv pip install --reinstall --no-deps "playwright==<base-version>"`.
- Guard the reinstall behind a version check so the common case (no
drift) skips the wheel download.
Resolves the 9 failing `uv`-variant scheduled e2e jobs in [run
26082797876](https://github.com/apify/crawlee-python/actions/runs/26082797876)
(`playwright`, `adaptive_beautifulsoup`, `adaptive_parsel` × {httpx,
curl_impersonate, impit}).
Verified against the live `apify/actor-python-playwright:3.13` image:
| Scenario | Before | After |
| --- | --- | --- |
| Real user, no drift | works, but `pip freeze \| grep playwright` check
is brittle | guard short-circuits, no extra work |
| Test injection downgrades playwright to 1.59.0 | mismatched chromium →
crash | reinstall pins to 1.60.0, browsers match |uv Dockerfile template (#1904)1 parent d424901 commit 8d902c9
1 file changed
Lines changed: 11 additions & 10 deletions
Lines changed: 11 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
45 | | - | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
46 | 49 | | |
47 | 50 | | |
48 | 51 | | |
| |||
51 | 54 | | |
52 | 55 | | |
53 | 56 | | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
62 | 62 | | |
| 63 | + | |
63 | 64 | | |
64 | 65 | | |
65 | 66 | | |
| |||
0 commit comments