Skip to content

fix: playwright chromium should use playwright mirror, not chrome-for-testing#71

Merged
fengmk2 merged 1 commit into
masterfrom
fix/playwright-chromium-download-host
Jul 2, 2026
Merged

fix: playwright chromium should use playwright mirror, not chrome-for-testing#71
fengmk2 merged 1 commit into
masterfrom
fix/playwright-chromium-download-host

Conversation

@elrrrrrrr

@elrrrrrrr elrrrrrrr commented Jul 2, 2026

Copy link
Copy Markdown
Member

背景

#67 新增了 PLAYWRIGHT_CHROMIUM_DOWNLOAD_HOST = https://cdn.npmmirror.com/binaries/chrome-for-testing,用于适配 playwright 1.58 起 chromium 改走 CFT。当时演示通过,是因为 playwright 1.58.0cftUrl 路径是 {browserVersion}/{platform}/...,恰好命中 npmmirror 的 chrome-for-testing 布局。

但这个指向随后失效,且误伤了老版本:

playwright chromium 下载路径 需要的 host
≤ 1.57.x builds/chromium/{rev}/chromium-mac-arm64.zip binaries/playwright
1.58.0 {browserVersion}/mac-arm64/chrome-mac-arm64.zip binaries/chrome-for-testing#67 只对这一版对
1.58.1+ builds/cft/{browserVersion}/mac-arm64/chrome-mac-arm64.zip binaries/playwright

两个问题:

  1. playwright 1.58.1 把 CFT 路径从 {version}/... 改成了 builds/cft/{version}/...chrome-for-testing 指向随之 404。
  2. ≥1.52 的所有版本都读 PLAYWRIGHT_CHROMIUM_DOWNLOAD_HOST(chromium 优先用它、再回退 PLAYWRIGHT_DOWNLOAD_HOST),所以该指向把 ≤1.57 也打挂了 —— ut i 装 playwright 1.57 直接 NoSuchKey 404。

改动

删除 PLAYWRIGHT_CHROMIUM_DOWNLOAD_HOST,让 chromium 回退到 PLAYWRIGHT_DOWNLOAD_HOST(= binaries/playwright),与 firefox/webkit 一致。cnpmcore 的 PlaywrightBinary 无论老 builds/chromium 还是新 builds/cft 都发布在 binaries/playwright 下,故这是唯一对所有版本都成立的 host。

注:1.58+ 能真正下载还依赖 cnpmcore 把 builds/cft/ 产物同步落盘(另有独立修复,见 cnpmcore 侧 PR)。本 PR 先修复 ≤1.57 的回归。

npm test 通过(8/8)。

🤖 Generated with Claude Code


This change is Reviewable

…-testing

`PLAYWRIGHT_CHROMIUM_DOWNLOAD_HOST` was set to `binaries/chrome-for-testing`
in #67. That only matched playwright 1.58.0's transient
`{version}/{platform}/...` layout. But:

- playwright 1.58.1 changed chromium to `builds/cft/{version}/...`
- playwright <= 1.57 still uses `builds/chromium/{rev}/...`

both are served under `binaries/playwright`, and every version >= 1.52 DOES
read `PLAYWRIGHT_CHROMIUM_DOWNLOAD_HOST` (chromium prefers it over
`PLAYWRIGHT_DOWNLOAD_HOST`), so the chrome-for-testing override 404s them —
e.g. `ut i` on playwright 1.57 fails with NoSuchKey.

Remove the override so chromium falls back to `PLAYWRIGHT_DOWNLOAD_HOST`
(= `binaries/playwright`), consistent with firefox/webkit.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6c8761c3-91f4-415d-b33f-8111ebb682dc

📥 Commits

Reviewing files that changed from the base of the PR and between 5afdc1c and 4055077.

📒 Files selected for processing (2)
  • package.json
  • test/index.test.js
💤 Files with no reviewable changes (2)
  • package.json
  • test/index.test.js

📝 Walkthrough

[!WARNING]

Walkthrough skipped

File diffs could not be summarized.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/playwright-chromium-download-host

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request removes the PLAYWRIGHT_CHROMIUM_DOWNLOAD_HOST environment variable from package.json and cleans up its corresponding references in the test suite within test/index.test.js. There are no review comments, and I have no feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@fengmk2 fengmk2 merged commit 39a2715 into master Jul 2, 2026
10 checks passed
@fengmk2 fengmk2 deleted the fix/playwright-chromium-download-host branch July 2, 2026 11:51
fengmk2 pushed a commit that referenced this pull request Jul 2, 2026
[skip ci]

## <small>2.20.1 (2026-07-02)</small>

* fix: playwright chromium should use playwright mirror, not chrome-for-testing (#71) ([39a2715](39a2715)), closes [#71](#71) [#67](#67) [#67](#67)
* chore(deps): update actions/checkout action to v7 (#70) ([5afdc1c](5afdc1c)), closes [#70](#70)
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 2.20.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

fengmk2 pushed a commit to cnpm/cnpmcore that referenced this pull request Jul 2, 2026
…zureedge (#1099)

## 问题

playwright >= 1.58 的 chromium 从镜像下载会
404:`binaries/playwright/builds/cft/{browserVersion}/...` 目录为空,从未被同步落盘。

## 根因

`PlaywrightBinary` 的上游 `DOWNLOAD_HOST` 用的是已废弃的
`playwright.azureedge.net`。实测(跟随 307 重定向):

| 上游路径 | azureedge | cdn.playwright.dev |
|---|---|---|
| `builds/chromium/1200/...`(老,≤1.57) | 200 | 200 |
| `builds/cft/145.0.7632.6/mac-arm64/...`(新,1.58.1+) | **400** ❌ |
**200** ✅ |

azureedge 只认老的 `builds/*`,**不认 playwright 1.58.1 起启用的 `builds/cft/*`
新命名空间**。所以同步 worker 抓 CFT 产物时拿到 400,chromium 二进制永远进不了镜像。

补充确认:playwright 从 1.58 起不再发布老结构
`builds/chromium/{rev}`(`cdn.playwright.dev/builds/chromium/1208` 也
404),1.58+ 的 chromium **只存在于 CFT 路径**,没有旧目录可回退——所以必须把 CFT 同步跑通。

## 改动

`DOWNLOAD_HOST` 从 `https://playwright.azureedge.net/` 换成
`https://cdn.playwright.dev/`,并同步更新测试断言。

已验证 cdn.playwright.dev 对 driver / firefox / webkit / ffmpeg / 老 chromium
/ 新 cft chromium **全部 200**,是 azureedge 的安全超集,不影响已有同步。

合并后需触发一次 playwright binary 重新同步,`builds/cft/` 产物才会落盘。

> 配套修复:cnpm/binary-mirror-config#71(把
`PLAYWRIGHT_CHROMIUM_DOWNLOAD_HOST` 从错误的 `chrome-for-testing` 指向移除,修复
≤1.57 的回归)。

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants