Cloudflare deploy fails after adding a custom domain: generated comment is parsed as JSON
Maintainers usually reply within 1 day
A pull request for this has already been merged.
- #498 by @Brooooooklyn — merged
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- node.js, typescript
- Domain
- devops
Research direction
Read packages/void/src/cli/cf-build-output.ts and the existing readGeneratedWranglerConfigFile helper in generated-wrangler-config.ts. Check the three configuration reads named in the issue, then reproduce with a void.lock.json comment containing the published traffic snapshot. Done when deployment preparation accepts the JSONC comment and preserves the custom domain; the issue reports a local workaround but no uploaded deployment.
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- TypeScript
- Stars
- 402
- Forks
- 32
- Avg merge
- 10h 51m
- Merged PRs (30d)
- 100
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from voidzero-dev/void
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
voidzero-dev/void#529 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 1/5 1-3 hours Newbie friendliness 78/100
voidzero-dev/void#428 ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 56/100
voidzero-dev/void#527 ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 54/100
voidzero-dev/void#525 ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 67/100
voidzero-dev/void#524 ·
Maintainers usually reply within 1 day
All issues in voidzero-dev/void
Similar issues
-
ready-for-agent
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
xavxyz/bei-shan-lin-shui#57 ·
Maintainers usually reply within 1 day
-
[BUG] rag: sentence content can cross the reported sentence boundariesPossibly taken @LJK-ikun claimed this today. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
bug needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 1 day
-
README: the Resource URI Schemas example's file://documents/* pattern only matches that literal URIOpen
Difficulty 1/5 Under an hour Newbie friendliness 88/100
platformatic/mcp#361 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
siyuan-note/siyuan#20799 · 7 comments ·
Maintainers usually reply within 1 day