cloudflare / cloudflare/developer-platform

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

Open
#20 2 comments 0 reactions 2 assignees Claimed by @irvinebroque View on GitHub
feature:workers-assets
Dominant language
No language data
Stars
1
Forks
0
PR merge metrics
No merged PRs in 30d

Description

### 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`).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.