Cloudflare deploy: framework prerender inside `void deploy`'s build deletes `.wrangler/deploy/config.json` (ENOENT)
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 78/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- typescript
- Ambito
- build-system, cloud
Direzione di ricerca
Inizia da restorePreviewPointer in dist/index.mjs e confronta il relativo controllo del build di deploy con il controllo sul lato stash descritto nell’issue. Esegui la riproduzione fornita con due build, quindi verifica che .wrangler/deploy/config.json rimanga dopo il build in modalità deploy quando è presente uno stash, mentre il comportamento dell’anteprima manuale resta invariato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Problem
In a TanStack Start app with voidPlugin() and TanStack's own build-time prerender (tanstackStart({ prerender: { enabled: true } })), void deploy fails after the build whenever an earlier plain vite build left a stashed pointer in .void/:
[prerender] Prerendered 4 pages:
...
◇ Preparing deployment...
■ ENOENT: no such file or directory, open '<root>/apps/web/.wrangler/deploy/config.json'
TanStack Start prerenders by starting a Vite preview server inside the build process. Void's plugin sees isPreview === true there and runs the preview restore path meant for a manual vite preview, including in the deploy build:
vite build ── closeBundle: stash .wrangler/deploy/config.json → .void/preview-deploy-config.json
void deploy
└ child build (VOID_CLOUDFLARE_DEPLOY_BUILD=1)
├ build writes a fresh .wrangler/deploy/config.json
├ prerender starts a Vite preview server
│ └ config(): isPreview → restoreCloudflarePreviewPointer()
│ ├ writes the stash from the earlier build over the pointer
│ └ process.once("exit", rmSync(.wrangler/deploy/config.json))
└ child exits → pointer deleted
└ readGeneratedDeployConfig() → ENOENT
The stash side already skips deploy builds (closeBundle checks VOID_CLOUDFLARE_DEPLOY_BUILD !== "1"). The restore side has no such check (dist/index.mjs, restorePreviewPointer in voidPlugin).
This is the same pointer mechanism as #419, reached from the other direction. There a preview could not find the pointer. Here a preview inside a deploy build removes it.
Repro
A fresh clone reproduces it without void connect and without Cloudflare credentials. The deploy-mode build uses the env void deploy gives its build child.
git clone https://github.com/SweetRetry/void-starter && cd void-starter
git checkout 5230137
pnpm install
cd apps/web
pnpm exec vp build # plain build, stashes the pointer
VOID_CLOUDFLARE_DEPLOY_BUILD=1 NODE_ENV=production pnpm exec vp build # what void deploy runs
ls .wrangler/deploy/config.json # missing
Prerender is configured in apps/web/vite.config.ts. The repo's deploy script works around the bug by deleting .void/preview-deploy-config.json first, so call vp build directly as above.
Controls, each starting from an empty .wrangler/deploy and .void/preview-deploy-config.json:
| Case | Stash before deploy build | Prerender | Pointer after deploy build |
|---|---|---|---|
| A | present | on | missing |
| B | deleted | on | present |
| C | present | off | present |
An exit listener registered through NODE_OPTIONS=--require (so it runs before Void's) saw the pointer present in case A. The outer processes then saw it missing, so it is removed by the exit cleanup.
Suggested fix
Skip the restore in deploy builds, the same check the stash side already has:
const restorePreviewPointer = () => {
if (!existsSync(join(root, "void.config.ts"))) return;
+ if (process.env["VOID_CLOUDFLARE_DEPLOY_BUILD"] === "1") return;
if (restoreCloudflarePreviewPointer(root) && !scheduledPreviewPointerCleanups.has(root)) {
With this patch applied to dist/index.mjs, case A keeps .wrangler/deploy/config.json ({"configPath":"../../dist/server/wrangler.json"}) after the deploy-mode build. A manual vite preview still finds the build output and gets as far as the remote binding session, which then fails only for lack of an API token in a non-interactive shell. That path runs without the env var, so its code is unchanged.
An alternative is for void deploy to remove .void/preview-deploy-config.json before it starts the build. That is the current workaround.
Question
The framework docs describe routing.prerender (deploy-time edge prerendering) for framework mode and don't mention a framework's own build-time prerender. Is TanStack Start's prerender option a supported setup with Void? We chose it so the blog pages ship as static assets in dist/client and a prerender failure fails the build.
Environment
- void 1.1.11
- @tanstack/react-start 1.169.2
- @cloudflare/vite-plugin 1.64.0, wrangler 4.151.0
- vite-plus 1.3.0
- Node 24.14.1, pnpm 12.0.0, macOS
- Lingua principale
- TypeScript
- Stelle
- 402
- Fork
- 32
- Merge medio
- 12h 28m
- PR unite (30g)
- 77
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di voidzero-dev/void
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
voidzero-dev/void#478 ·
I maintainer di solito rispondono entro 1 giorno
-
Deploy after a secret change fails for Workers over ~750 KB: source read-back capped at 1 MiBAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
voidzero-dev/void#459 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 1/5 1-3 ore Idoneità per principianti 78/100
voidzero-dev/void#428 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
voidzero-dev/void#480 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 56/100
voidzero-dev/void#477 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di voidzero-dev/void
Issue simili
-
Unsampled pageload span is profiled when profileLifecycle is 'trace' (browser UI profiling)Forse già presa @Jxxunnn l’ha presa oggi. ApertaBrowser Waiting for: Product Owner
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
getsentry/sentry-javascript#25497 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
e2e-failure ready-to-code
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
redhat-developer/rhdh-plugin-export-overlays#4438 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
resource: destroying a resource calls AbortController.abort() without a reason, creating an AbortError with a stack trace each timeForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertaarea: core
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
angular/angular#71422 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug status: needs triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
facebook/docusaurus#12739 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
factory-active task-identify-harness-labels-done task-identify-issue-type-done
Difficoltà 1/5 1-3 ore Idoneità per principianti 68/100
vercel/ai#23537 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno