Cloudflare deploy fails after adding a custom domain: generated comment is parsed as JSON
维护者通常 1 天内回复
已经有一个关联 PR 被合并了。
- #498 来自 @Brooooooklyn —— 已合并
评估
- 难度
- 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
- 平均合并
- 11 小时 52 分钟
- 30 天内合并 PR
- 88
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
voidzero-dev/void 的其他 Issue
-
bug
难度 1/5 1-3 小时 新手友好度 78/100
voidzero-dev/void#428 ·
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 35/100
voidzero-dev/void#511 ·
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 35/100
voidzero-dev/void#510 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 58/100
voidzero-dev/void#509 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 55/100
voidzero-dev/void#507 ·
维护者通常 1 天内回复
查看 voidzero-dev/void 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 77/100
melgarafael/DeskcommCRM#3104 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
bug service: webapp
难度 2/5 1-3 小时 新手友好度 82/100
Ocelot-Social-Community/Ocelot-Social#10684 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
nicobailon/pi-subagents#2978 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 66/100
getsentry/sentry-conventions#732 · 1 条评论 ·
维护者通常 1 天内回复