Skip to content

store: a conditional write is an overwrite, as the Blob SDK requires - #10

Merged
azank1 merged 1 commit into
mainfrom
fix/gallery-conditional-put
Oct 13, 2026
Merged

azank1 merged 1 commit into
mainfrom
fix/gallery-conditional-put

Conversation

@azank1

@azank1 azank1 commented Oct 13, 2026

Copy link
Copy Markdown
Owner

Every build since #8 shipped drew its city and wrote its meta, but none reached the recent list on the home page.

Cause. The gallery's conditional write sent ifMatch beside allowOverwrite: false. @vercel/blob 2.8.0 refuses that combination before sending anything. Production logged it for each finish:

gallery BlobError: Vercel Blob: ifMatch and allowOverwrite: false are contradictory. ifMatch is used for conditional overwrites, which requires allowOverwrite to be true.
    at async BlobStore.put (web/lib/store.ts:60:17)
    at async updateGallery (web/lib/city.ts:266:7)

finishBuild catches gallery failures and carries on, so build-city.mjs reported "done". The stand-in stores in the tests accepted the combination, so the suite passed.

Fix. BlobStore.put asks for an overwrite whenever it sends ifMatch. A plain write still never overwrites unless asked.

Test. test/store-blob.test.ts drives the real SDK with only its HTTP mocked (undici's MockAgent; undici is now an exact devDependency at the version already installed). It checks:

  • the headers that conditional, plain and overwriting writes send
  • that a 412 surfaces as StoreConflict
  • stat for a present blob and a missing one

Without the fix, two of the four fail with the production error. Suite: 53 tests, 47 pass, 6 live tests skipped, 0 fail; typecheck clean.

Also confirmed in production while finding this (no change needed). The memory fix from #7 works. Rebuilding vercel replayed vercel/bridge, vercel/eve and vercel/next-evals-oss, the three repos that had failed as "too big" (vercel/bridge in 0.5 s). The city went from 19,089 commits with 3 failures to 21,336 with none. The production log reads live 940 MB, rss 945 MB at the busiest point.

After merge. Rebuild vercel. Then check that /api/gallery lists it first with 21,336 commits. That proves the versioned read path, where the store keeps the version= content-type parameter. Then rebuild the other gallery cities.

The gallery's conditional write passed ifMatch beside allowOverwrite: false, which
@vercel/blob refuses before sending anything ("ifMatch and allowOverwrite: false are
contradictory"). finishBuild logs a gallery failure and carries on, so every build since
the versioned gallery shipped drew its city and wrote its meta but never reached the
recent list. The stand-in stores in the tests accepted the combination.

BlobStore now asks for an overwrite whenever it sends ifMatch, and a new test drives the
real SDK with only its HTTP mocked (undici's MockAgent), checking the headers a
conditional, a plain and an overwriting write send, a lost race as StoreConflict, and
stat. Without the fix it fails with the production error.
@vercel

vercel Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
commit-city Ready Ready Preview Oct 13, 2026 12:38pm UTC

@azank1
azank1 marked this pull request as ready for review October 13, 2026 13:07
@azank1
azank1 merged commit 5a09b52 into main Oct 13, 2026
5 checks passed

This branch was successfully deployed

1 active deployment
Preview — 82fc5c83 Deployed Oct 13, 2026 by vercel[bot]
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.

1 participant