Describe the Bug
Edit: Previously, I was able to reproduce it around 30% of the time. Classical: Now it seems to happen less often. Hard to say what has changed, and I am using the same files.
When using @payloadcms/storage-vercel-blob with clientUpload: true, image uploads fail sometimes with the reproduction repo (blank payload project + vercel blob storage plugin).
The network tab shows that
vercel-blob-client-upload-route correctly creates a token
- the upload of the file to vercel is also successful
- but the following
POST call to /api/media?depth=0&fallback-locale=null fails with 400.
The logs indicate an issue with getImageSize in generateFileData:
[23:45:22] ERROR: unsupported file type: undefined
err: {
"type": "TypeError",
"message": "unsupported file type: undefined",
"stack":
TypeError: unsupported file type: undefined
at imageSize (file:///vercel-storage-blob-bug-repo/node_modules/.pnpm/image-size@2.0.2/node_modules/image-size/dist/index.mjs:985:9)
at getImageSize (file:///vercel-storage-blob-bug-repo/node_modules/.pnpm/payload@3.64.0_graphql@16.12.0_typescript@5.7.3/node_modules/payload/dist/uploads/getImageSize.js:20:12)
at generateFileData (file:///vercel-storage-blob-bug-repo/node_modules/.pnpm/payload@3.64.0_graphql@16.12.0_typescript@5.7.3/node_modules/payload/dist/uploads/generateFileData.js:142:32)
...
My first suspicion was that my image is corrupted, but my test image (a png) could sometimes be uploaded and sometimes not. I was able to reproduce it with multiple different images.
- I was able to reproduce it both locally and when the app is deployed on Vercel.
- I could not reproduce it when using
clientUpload: false.
Please let me know if I can help any further to fix this bug.
Link to the code that reproduces this issue
https://github.com/FlavioReinhard/payload-vercel-blob-storage-repro
Reproduction Steps
- Create a vercel blob storage
- Provide the env variable
BLOB_READ_WRITE_TOKEN in the .env file
- Start up payload:
pnpm dev
- Upload an image to the media collection. Try it multiple times.
Which area(s) are affected? (Select all that apply)
plugin: storage-*
Environment Info
Binaries:
Node: 18.20.7
npm: 10.8.2
Yarn: 1.22.22
pnpm: 10.6.4
Relevant Packages:
payload: 3.64.0
next: 15.4.7
@payloadcms/db-mongodb: 3.64.0
@payloadcms/graphql: 3.64.0
@payloadcms/next/utilities: 3.64.0
@payloadcms/plugin-cloud-storage: 3.64.0
@payloadcms/richtext-lexical: 3.64.0
@payloadcms/storage-vercel-blob: 3.64.0
@payloadcms/translations: 3.64.0
@payloadcms/ui/shared: 3.64.0
react: 19.1.0
react-dom: 19.1.0
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 25.1.0: Mon Oct 20 19:32:56 PDT 2025; root:xnu-12377.41.6~2/RELEASE_ARM64_T8132
Available memory (MB): 24576
Available CPU cores: 10
Describe the Bug
Edit: Previously, I was able to reproduce it around 30% of the time. Classical: Now it seems to happen less often. Hard to say what has changed, and I am using the same files.
When using
@payloadcms/storage-vercel-blobwithclientUpload: true, image uploads fail sometimes with the reproduction repo (blank payload project + vercel blob storage plugin).The network tab shows that
vercel-blob-client-upload-routecorrectly creates a tokenPOSTcall to/api/media?depth=0&fallback-locale=nullfails with400.The logs indicate an issue with
getImageSizeingenerateFileData:My first suspicion was that my image is corrupted, but my test image (a png) could sometimes be uploaded and sometimes not. I was able to reproduce it with multiple different images.
clientUpload: false.Please let me know if I can help any further to fix this bug.
Link to the code that reproduces this issue
https://github.com/FlavioReinhard/payload-vercel-blob-storage-repro
Reproduction Steps
BLOB_READ_WRITE_TOKENin the.envfilepnpm devWhich area(s) are affected? (Select all that apply)
plugin: storage-*
Environment Info