Vercel — AI · · 1 min read

Vercel Blob now supports consistent reads on private storage

Mirrored from Vercel — AI for archival readability. Support the source by reading on the original site.

Vercel Blob now supports consistent reads on private storage. Pass useCache: false to get() or presignUrl() for a read that reflects the latest write.

A blob written to a fresh pathname has no existing cached entry, so reads reflect the latest write immediately. When you overwrite a blob at an existing pathname, readers might see the cached version for up to 60 seconds.

When a read must reflect the latest write, like an agent's memory file, a session transcript, or a scheduled JSON report, pass useCache: false. These reads bypass the CDN, take longer than cached reads, and incur Fast Origin Transfer.

import { put, get } from '@vercel/blob';
await put('reports/latest.json', JSON.stringify(report), {
access: 'private',
// New blobs are read-after-write consistent: this read reflects the fresh write
let result = await get('reports/latest.json', { access: 'private' });
// Overwrite the report at the same pathname
await put('reports/latest.json', JSON.stringify(updatedReport), {
access: 'private',
allowOverwrite: true,
// A default read can return the previous version for up to 60 seconds.
// A consistent read is guaranteed to reflect the update:
result = await get('reports/latest.json', {
access: 'private',
useCache: false,

You can also bypass the cache without the SDK. Under the hood, useCache: false adds a cache=0 query parameter to the request. You can set it yourself on a private blob URL:

curl "https://<store-id>.private.blob.vercel-storage.com/file.json?cache=0" \
-H "Authorization: Bearer $BLOB_READ_WRITE_TOKEN"

Install the latest @vercel/blob SDK for consistent reads:

npm install @vercel/[email protected]

Learn more in the consistent reads documentation.

Discussion (0)

Sign in to join the discussion. Free account, 30 seconds — email code or GitHub.

Sign in →

No comments yet. Sign in and be the first to say something.

More from Vercel — AI