Cloudflare deploy fails after adding a custom domain: generated comment is parsed as JSON
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 新手友好度
- 78/100
- Issue 類型
- 缺陷
- 描述清晰度
- 描述清楚
- 活躍度
- 活躍
- 技術堆疊
- node.js, typescript
- 領域
- devops
研究方向
閱讀packages/void/src/cli/cf-build-output.ts以及generated-wrangler-config.ts中現有的輔助函式readGeneratedWranglerConfigFile。檢查 issue 中提到的三處設定讀取,接著使用包含已發布流量快照的void.lock.json註解重現問題。當部署準備程序接受 JSONC 註解並保留自訂網域時,即為完成;issue 回報了本機的解決方法,但沒有上傳部署。
由索引模型根據 Issue 內容生成。
描述
void deploy fails after adding a Cloudflare custom domain. Void saves a comment in the generated configuration, then tries to read that file with JSON.parse.
Steps to reproduce
- Deploy an Astro app to your own Cloudflare account with
pnpm exec void deploy. - Attach a domain in that account with
pnpm exec void domain add example.com. - Commit the updated
void.lock.json. - Run
pnpm exec void deployagain, including from a fresh CI checkout.
The build completes, but deployment stops at:
◇ Preparing deployment...
■ Unexpected token '/', "// void:pu"... is not valid JSON
The expected result is a successful deployment with the custom domain preserved.
Cause
The domain command saves a published-traffic snapshot as a comment:
// void:published-traffic:v1:...
That comment is saved in void.lock.json's text field and restored into .void-wrangler.jsonc. The file is valid JSONC, which allows comments, but not strict JSON.
prepareCfFrameworkBuildOutput reads the file with JSON.parse. The same file also uses JSON.parse in prepareCfStaticBuildOutput and the legacy path of prepareCfBuildOutput.
Local workaround
I patched those three reads to use the existing readGeneratedWranglerConfigFile helper from generated-wrangler-config.ts. That helper already handles comments and rejects invalid input.
I reproduced the original parsing error locally. With the patch, the same Worker preparation step accepts the comment and produces deployment output. This check did not upload the Worker. A frozen-lockfile install also succeeds with the pnpm patch.
Versions
- Void: 1.1.11
- Astro: 7.4.0
@astrojs/cloudflare: 14.4.0- Failing CI environment: GitHub Actions, Linux, Node.js 24.21.0
The JSON.parse calls are also present on main at 43c7fe17e402d4509516796eec3e7c832a2b0630.
- 主要語言
- TypeScript
- 星號
- 402
- 分支
- 32
- 平均合併
- 12 小時 1 分鐘
- 30 天內合併 PR
- 80
環境準備
這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
voidzero-dev/void 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 78/100
voidzero-dev/void#463 ·
維護者通常 1 天內回覆
-
Deploy after a secret change fails for Workers over ~750 KB: source read-back capped at 1 MiB可能已有人在做 @Brooooooklyn 於 1 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 82/100
voidzero-dev/void#459 · 已指派 1 人 ·
維護者通常 1 天內回覆
-
bug
難度 1/5 1-3 小時 新手友好度 78/100
voidzero-dev/void#428 ·
維護者通常 1 天內回覆
-
Allow `npm create void` and `void init` to run without prompts可能已有人在做 @ashunar0 於 1 天前認領。 未關閉
難度 4/5 3-5 天 新手友好度 57/100
voidzero-dev/void#491 · 1 則留言 ·
維護者通常 1 天內回覆
-
難度 4/5 3-5 天 新手友好度 53/100
voidzero-dev/void#486 ·
維護者通常 1 天內回覆
查看 voidzero-dev/void 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 66/100
getsentry/sentry-conventions#732 · 1 則留言 ·
維護者通常 1 天內回覆
-
status:in-linear status:team-assigned team:nodes
難度 2/5 1-3 小時 新手友好度 76/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 82/100
motiondivision/motion#3955 ·
維護者通常 1 天內回覆
-
enhancement
難度 2/5 1-3 小時 新手友好度 68/100
equinor/prisma-decision-web#919 ·
維護者通常 1 天內回覆
-
難度 1/5 1 小時以內 新手友好度 83/100