[Workers Assets] _headers updates are dropped when wrangler deploy hits "No updated asset files to upload"
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- typescript
- Ambito
- backend-api-design, cli
Direzione di ricerca
Start by tracing how Wrangler handles static asset uploads during wrangler versions upload and wrangler deploy, especially the empty upload-session path that logs “No updated asset files to upload.” Compare how the _headers metadata is submitted and carried into the new Worker version when assets are uploaded versus when the upload is empty. Done means the deployed version retains the submitted _headers rules even when no asset files need uploading.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
What versions & operating system are you using?
- Wrangler:
4.166.0(running in Cloudflare Workers Builds, Linux x64) - Node:
24.22.1, pnpm:12.10.1 - Framework / Adapter:
[email protected],@astrojs/[email protected](redirecteddist/server/wrangler.jsonwithassets.directory = "../client")
Please provide a link to a minimal reproduction
Public repository where this reproduced twice in a row on Workers Builds: https://github.com/withxat/ImI (see public/_headers added/updated in commit 46a9690 / PR #37, and again across PR #38).
Describe the Bug
When a Workers Builds PR preview runs npx wrangler versions upload and uploads new/modified static assets along with an updated _headers file, the resulting preview Worker version stores the updated _headers correctly in resources.script_runtime.assets.raw_headers and resources.script_runtime.assets.headers.rules.
Minutes later, when the same PR is merged to main and Workers Builds runs npx wrangler deploy, /assets-upload-session returns empty buckets (No updated asset files to upload. Proceeding with deployment...) because the preview build already uploaded the identical static asset hashes. On that wrangler deploy, the newly created production Worker version silently drops the _headers update and reverts raw_headers / headers.rules to the previous production _headers (from before PR #37).
Evidence across 5 consecutive builds (same repo, config, and Wrangler version)
Every commit below has the Content-Security-Policy line under /* in public/_headers, and every build log confirms Vite + @astrojs/cloudflare generated a fresh dist/client/_headers (logging ✨ Parsed 12 valid header rules. and [@astrojs/cloudflare] Injected immutable Cache-Control for /_astro/* into _headers., which @astrojs/cloudflare only logs when dist/client/_headers does not already contain /_astro/*):
| Worker Version | Branch / Commit | Deploy command | Asset upload result | assets.raw_headers includes new Content-Security-Policy |
|---|---|---|---|---|
| #288 | PR #37 preview (46a9690) |
npx wrangler versions upload |
Uploaded new static assets | Yes |
| #289 | main (868e5e4, PR #37 merge) |
npx wrangler deploy |
Assets already uploaded by #288 | No (reverted to pre-PR #37 _headers) |
| #290 | main (db8acc9, docs-only) |
npx wrangler deploy |
No updated asset files to upload |
No |
| #291 | PR #38 preview (ae425e5) |
npx wrangler versions upload |
Found 35 new or modified static assets |
Yes |
| #292 | main (d6c14d5, PR #38 merge) |
npx wrangler deploy |
No updated asset files to upload |
No (reverted to pre-PR #37 _headers again) |
Expected Behavior
metadata.assets.config._headers submitted with wrangler deploy should always update assets.raw_headers and assets.headers.rules on the new Worker version, even when /assets-upload-session returns empty buckets (No updated asset files to upload) — otherwise any _headers-only edit or PR merge following a preview upload cannot take effect in production.
Reproduction Steps
- Configure a Worker with Static Assets and Cloudflare Workers Builds (PR previews running
npx wrangler versions upload,maindeploys runningnpx wrangler deploy). - Open a PR that edits
public/_headers(e.g. adds aContent-Security-Policyheader under/*) along with static asset changes. - After the PR preview build succeeds, inspect
GET /accounts/{account_id}/workers/scripts/{script_name}/versions/{version_id}—resources.script_runtime.assets.raw_headersandheaders.rules["/*"].setcontain the new header. - Merge the PR to
mainso Workers Builds runsnpx wrangler deployand logsNo updated asset files to upload. Proceeding with deployment.... - Inspect the newly deployed production version via the same API and check static asset HTTP response headers — the new header is missing and
raw_headershas reverted to the older production_headers.
Please provide any relevant error logs
No errors or warnings are emitted in either build.
PR #38 preview (wrangler versions upload -> version #291, _headers updated):
06:06:37 [vite] ✓ 109 assets moved from "ssr" to "client" build output.
✨ Parsed 12 valid header rules.
06:06:38 [build] Rearranging server assets...
06:06:38 [@astrojs/cloudflare] Injected immutable Cache-Control for /_astro/* into _headers.
Executing user deploy command: npx wrangler versions upload
🌀 Building list of assets...
✨ Read 504 files from the assets directory /opt/buildhome/repo/dist/client
🌀 Starting asset upload...
🌀 Found 35 new or modified static assets to upload. Proceeding with upload...
✨ Success! Uploaded 35 files (452 already uploaded) (1.06 sec)
Uploaded imi (3.39 sec)
main merge 2 minutes later (wrangler deploy -> version #292, _headers reverted):
06:08:41 [vite] ✓ 109 assets moved from "ssr" to "client" build output.
✨ Parsed 12 valid header rules.
06:08:42 [build] Rearranging server assets...
06:08:42 [@astrojs/cloudflare] Injected immutable Cache-Control for /_astro/* into _headers.
Executing user deploy command: npx wrangler deploy
🌀 Building list of assets...
✨ Read 504 files from the assets directory /opt/buildhome/repo/dist/client
🌀 Starting asset upload...
No updated asset files to upload. Proceeding with deployment...
Uploaded imi (3.31 sec)
Deployed imi triggers (0.48 sec)
- Lingua principale
- TypeScript
- Stelle
- 4.7k
- Fork
- 1.7k
- Merge medio
- 1g 22h
- PR unite (30g)
- 282
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
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 cloudflare/workers-sdk
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
cloudflare/workers-sdk#17215 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
cloudflare/workers-sdk#17189 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
cloudflare/workers-sdk#17187 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
cloudflare/workers-sdk#17175 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
cloudflare/workers-sdk#17174 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di cloudflare/workers-sdk
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
earendil-works/pi#12615 ·
I maintainer di solito rispondono entro 1 giorno
-
My Caps shows "Shared" on private Caps that were never sharedForse già presa @AksharP5 l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
CapSoftware/Cap#4569 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
OHDSI/Data2Evidence#3749 ·
I maintainer di solito rispondono entro 4 giorni
-
PWA: Unique Page TitlesAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 63/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
Flagsmith/flagsmith-nodejs-client#332 ·
I maintainer di solito rispondono entro 2 giorni