Repository navigation
Description
Describe the Bug
With clientUploads: true on @payloadcms/storage-vercel-blob, any client upload that Payload runs through sharp ends up stored as a 0-byte object, while the document keeps a non-zero filesize. That covers every WebP, GIF and TIFF (isAnimatedImage types), any image cropped in the same save as its client upload, and every resizable image when the collection sets resizeOptions, formatOptions, trimOptions or constructorOptions.
The mechanism on 3.90.2:
getFileFromClientUploadreturns the file withdata: Buffer.alloc(0)and atempFilePath(since fix: avoid buffering large client uploads into memory #17856 / fix: avoid buffering large client uploads into memory #17872, 3.89.0).generateFileDataruns sharp for these files, thendelete file.clientUploadContext(andfileForResize.clientUploadContextin the crop path). Because atempFilePathexists, it writes the processed bytes only to that temp file (fs.writeFile(file.tempFilePath, …)) and leavesreq.file.dataempty.plugin-cloud-storage'safterChangeno longer sees aclientUploadContext, so it stops skipping the file and callsadapter.handleUploadwithbuffer: file.data, the empty buffer.- The Vercel Blob adapter
puts that buffer withallowOverwrite: trueat<prefix>/<_objectKey>/<filename>, replacing the file the browser had just uploaded with 0 bytes.
The deletes were added in 3.90.0 by 8e880a4 ("fix: incorrect prefix from client upload"). The same deletes are on 3.x and on main (as uploadReference). JPEG, PNG and AVIF without edits are not affected unless the collection sets one of the options above: otherwise sharp does not run, clientUploadContext survives and afterChange skips them.
The GCS, R2 and UploadThing adapters also upload only file.buffer, so they should be affected the same way; S3 and Azure read tempFilePath when present. We only reproduced it on Vercel Blob.
A possible fix: have getIncomingFiles (or each adapter) read tempFilePath when present, as the S3 and Azure adapters do, or keep clientUploadContext and re-upload the processed file explicitly.
Link to the code that reproduces this issue
https://github.com/franknoel/payload-blob-client-upload-empty (blank template plus storage-vercel-blob with clientUploads: true; pnpm check compares each document's filesize with its stored object)
Reproduction Steps
- Configure
storage-vercel-blobwithclientUploads: trueon an upload collection, withsharpset in the Payload config:vercelBlobStorage({ clientUploads: true, collections: { media: true }, token: process.env.BLOB_READ_WRITE_TOKEN, })
- In the admin, upload a WebP (or a PNG with a crop set before saving). Save.
- The document shows the expected
filesize, width and height, buthead()orlist()on the Blob store shows the object at 0 bytes, and the image URL returns an empty body.
We hit this on a staging site: WebP images editors uploaded after moving to 3.90 were stored as 0-byte objects. We reproduced the crop case locally.
Which area(s) are affected?
plugin: cloud-storage, plugin: storage-*, area: core
Environment Info
payload: 3.90.2
@payloadcms/plugin-cloud-storage: 3.90.2
@payloadcms/storage-vercel-blob: 3.90.2
next: 16.3.6
sharp: 0.35.4
Node: 24.21.0, deployed on Vercel
Activity
razaanstha commentedon Sep 29, 2026
+1
drianoaz commentedon Oct 17, 2026
Reproduced on 3.91.0 as well (
payload,@payloadcms/plugin-cloud-storageand@payloadcms/storage-vercel-blob3.91.0,next start, real Vercel Blob store), so the latest stable is still affected.One difference worth noting for anyone using
addRandomSuffix: true: the browser's object is not overwritten.handleUploadputs the empty buffer under a new suffixed key, andafterChangerewrites the document'sfilenameto it:<_objectKey>/photo.webp(client upload, now orphaned)<_objectKey>/photo-<suffix>.webp(server re-upload, what the document points to)So with a suffix the original bytes survive, and affected documents can be recovered by re-uploading or re-pointing them. Without a suffix they are overwritten, as described above.
To find affected documents, list the store and look for 0-byte objects that have a non-empty sibling with the same base name in the same
_objectKeyfolder.Symptom in the admin, in case it helps others find this issue: the thumbnail is broken and the crop dialog shows width and height as 0.
@nathanlentz, does #18387 / #18388 also cover
addRandomSuffix: true? From the description, processed client uploads keep the receipt's key, which would also stop the suffixed duplicate.nathanlentz commentedon Oct 21, 2026
@drianoaz I'll address the
addRandomSuffix: trueissue you describe in a separate pull request.fix(storage-vercel-blob): upload processed client files from temp file (
fix(plugin-cloud-storage): store processed bytes for cropped and misl…
fix(storage-vercel-blob): keep the receipt key for processed client u…
fix: upload processed client files from temp file for upload-thing st…
github-actions commentedon Oct 27, 2026
🚀 This is included in version v3.92.1
fix: delete the browser upload when a processed client upload replace…
nathanlentz commentedon Oct 29, 2026
This issue is resolved via #19010 and #19012