cloudflare / cloudflare/developer-platform

Workers Assets: assets-upload-session returns empty buckets for genuinely new assets

Abierto
#20 2 comentarios 0 reacciones 2 asignados Reclamado por @irvinebroque Ver en GitHub
feature:workers-assets
Lenguaje dominante
Sin datos de lenguaje
Estrellas
1
Forks
0
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

### What versions & operating system are you using?

```
wrangler 4.61.0 (via cloudflare/wrangler-action@v3)
Node 24.12.0
Ubuntu (GitHub Actions runner)
```

### Describe the Bug

When deploying a Workers project with static assets (`"assets": { "directory": "dist/public" }`), the `/assets-upload-session` API incorrectly returns empty buckets for assets that have genuinely different content, causing the deployed version to serve stale client bundles.

#### Evidence from CI logs

We have two consecutive deploys where the build output shows **different filenames, different content, and different file sizes**, yet the API reports "No updated asset files to upload":

**Deploy A** (run `22077919320`, commit `c368cc5`) — ✅ uploaded correctly:
```
🌀 Found 40 new or modified static assets to upload.
✨ Success! Uploaded 40 files (24 already uploaded)
```
Build output included: `Modal-BIq0g2Ao.js (2.10 kB)`, `client-DuwEstlc.js (0.19 kB)`

**Deploy B** (run `22080601514`, commit `7f1d0e0`) — ❌ incorrectly skipped:
```
✨ Read 70 files from the assets directory
No updated asset files to upload. Proceeding with deployment...
```
Build output included: `Modal-DImRQqvX.js (3.46 kB)`, `client-mb1BL8z1.js (0.19 kB)`

Note: `Modal-BIq0g2Ao.js` is **2.10 kB** vs `Modal-DImRQqvX.js` is **3.46 kB** — these are different files with different content and different sizes. The API should not have returned empty buckets.

#### Impact

The JWT returned from the empty-bucket response appears to reference the previous asset manifest rather than the new one. This caused production to serve old client JS bundles containing a deleted server reference hash (`93aa02ddb19d` from a renamed file) instead of the new hash (`96621b26d012`), resulting in "server reference not found" runtime errors.

#### Reproduction

This is intermittent and tied to the server-side deduplication logic, so we cannot provide a minimal local reproduction. However, the pattern is:

1. Deploy a Workers project with static assets — assets upload correctly
2. Deploy again with source changes that produce different client bundles (different filenames, different content hashes, different file sizes)
3. The `assets-upload-session` API returns empty buckets despite the manifest containing new hashes
4. The deployed version serves stale assets from the previous deployment

#### Workaround

Writing a unique file (e.g., `echo $GITHUB_SHA > dist/public/build.txt`) before deploy forces at least one asset hash to differ, which appears to make the API correctly process the full manifest.

### Configuration

```json
{
"name": "app-presto",
"main": "dist/server/serve-cloudflare.js",
"assets": { "directory": "dist/public" },
"workers_dev": true
}
```

Deploy command: `wrangler deploy` (not `versions upload`).

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.