Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Cloudflare deploy fails after adding a custom domain: generated comment is parsed as JSON

Closed Beginner friendly
#484 0 comments 0 reactions 0 assignees View on GitHub

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

  1. Deploy an Astro app to your own Cloudflare account with pnpm exec void deploy.
  2. Attach a domain in that account with pnpm exec void domain add example.com.
  3. Commit the updated void.lock.json.
  4. Run pnpm exec void deploy again, 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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from voidzero-dev/void

All issues in voidzero-dev/void

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.