Skip to content

fix(deploy): read the framework Worker config as JSONC - #498

Merged
Brooooooklyn merged 1 commit into
mainfrom
fix/cf-build-output-jsonc
Oct 20, 2026
Merged

Brooooooklyn merged 1 commit into
mainfrom
fix/cf-build-output-jsonc

Conversation

@Brooooooklyn

Copy link
Copy Markdown
Member

Fixes #484

Problem

void domain add  → "// void:published-traffic:v1:..." saved in void.lock.json
fresh checkout   → restored into .void-wrangler.jsonc (valid JSONC)
void deploy      → prepareCfFrameworkBuildOutput: JSON.parse(...)  ✗
                   Unexpected token '/', "// void:pu"... is not valid JSON

It affects framework apps whose Worker output is deployed directly (Astro, SvelteKit, Nuxt, Analog).

Fix

prepareCfFrameworkBuildOutput now reads the config with readGeneratedWranglerConfigFile. Other code that reads this file already uses that helper. It accepts comments, a BOM and trailing commas, and still rejects bad input.

The issue also names two other JSON.parse reads in cf-build-output.ts. I left them as they are on purpose, because Void always writes those files as plain JSON:

Read File Written by
prepareCfStaticBuildOutput .void/deploy/cloudflare/wrangler-static.json JSON.stringify (deploy-cloudflare-static.ts)
prepareCfBuildOutput build output wrangler.json @cloudflare/vite-plugin or a scratch dir, both JSON.stringify

Tests

packages/void/test/unit/cf-build-output.test.ts:

  • Real flow: write the snapshot with Void's own writer, delete the config, restore it from the lock, run writeCloudflareFrameworkDeployConfig, follow the deploy pointer, then prepare the build output.
  • Parsing: JSONC with a BOM, a comment and a trailing comma is accepted. A broken config or a non-object config is still rejected.

On main, both tests fail with the error from the issue. Checks run:

  • 5 deploy-path unit files pass (645 tests);
  • lint, format and typecheck are clean.

🤖 Generated with Claude Code

After `void domain add`, the root Wrangler config keeps Void's
published-traffic comment, also when restored from void.lock.json.
prepareCfFrameworkBuildOutput read it with JSON.parse, so the next
`void deploy` of a framework app stopped at "Preparing deployment...".
Read it with readGeneratedWranglerConfigFile, as the other readers of
this file already do.

Fixes #484

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

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-20T05:11:15.634998Z 56fec8a Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview URL: https://fix-cf-build-output-jsonc-void-cloud.voidzero-docs.workers.dev (commit 56fec8a)

This URL reflects your latest Preview deployment

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://13455eb0-void-cloud.voidzero-docs.workers.dev 56fec8a 2026-10-20T05:10:48.802Z Visit the dashboard ↗

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: 56fec8ab74

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Brooooooklyn
Brooooooklyn merged commit bd8f4e2 into main Oct 20, 2026
20 checks passed
@Brooooooklyn
Brooooooklyn deleted the fix/cf-build-output-jsonc branch October 20, 2026 07:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant