storage-vercel-blob: clientUploads stores WebP, GIF and cropped uploads as 0-byte objects
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 #17856 / #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 8e880a4763 ("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 VercelSource: payloadcms/payload