-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Closed as duplicate of#12544
Closed as duplicate of#12544
Copy link
Description
Describe the Bug
Blob storage uploads with this basic vercel blob storage plugin do work.
plugins: [
vercelBlobStorage({
collections: {
media: true
},
token: process.env.BLOB_READ_WRITE_TOKEN,
}),But when I add the following two configs (prefix and clientUploads)...
plugins: [
vercelBlobStorage({
collections: {
media: {
prefix: "manual-battery-charger",
},
},
clientUploads: true,
token: process.env.BLOB_READ_WRITE_TOKEN,
}),... I get error messages:
[02:04:16] ERROR: There was an error while uploading files corresponding to the collection media with filename bea.pdf:
[02:04:16] ERROR: Vercel Blob: Missing [x]-content-length header.
err: {
"type": "BlobError",
"message": "Vercel Blob: Missing [x]-content-length header.",
"stack":
Error: Vercel Blob: Missing [x]-content-length header.
at getBlobError (webpack-internal:///(rsc)/./node_modules/@payloadcms/storage-vercel-blob/node_modules/@vercel/blob/dist/chunk-IDKCY4S2.js:162:15)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async eval (webpack-internal:///(rsc)/./node_modules/@payloadcms/storage-vercel-blob/node_modules/@vercel/blob/dist/chunk-IDKCY4S2.js:194:31)
at async requestApi (webpack-internal:///(rsc)/./node_modules/@payloadcms/storage-vercel-blob/node_modules/@vercel/blob/dist/chunk-IDKCY4S2.js:181:23)
at async put (webpack-internal:///(rsc)/./node_modules/@payloadcms/storage-vercel-blob/node_modules/@vercel/blob/dist/chunk-IDKCY4S2.js:701:22)
at async Object.eval [as handleUpload] (webpack-internal:///(rsc)/./node_modules/@payloadcms/storage-vercel-blob/dist/handleUpload.js:12:24)
at async eval (webpack-internal:///(rsc)/./node_modules/@payloadcms/plugin-cloud-storage/dist/hooks/beforeChange.js:38:21)
at async Promise.all (index 0)
at async eval (webpack-internal:///(rsc)/./node_modules/@payloadcms/plugin-cloud-storage/dist/hooks/beforeChange.js:46:17)
at async createOperation (webpack-internal:///(rsc)/./node_modules/payload/dist/collections/operations/create.js:145:24)
at async createHandler (webpack-internal:///(rsc)/./node_modules/payload/dist/collections/endpoints/create.js:28:17)
at async handleEndpoints (webpack-internal:///(rsc)/./node_modules/payload/dist/utilities/handleEndpoints.js:178:26)
at async eval (webpack-internal:///(rsc)/./node_modules/@payloadcms/next/dist/routes/rest/index.js:27:20)
...
[02:04:16] ERROR: Vercel Blob: Missing [x]-content-length header.
err: {
"type": "BlobError",
"message": "Vercel Blob: Missing [x]-content-length header.",
"stack":
Error: Vercel Blob: Missing [x]-content-length header.
at getBlobError (webpack-internal:///(rsc)/./node_modules/@payloadcms/storage-vercel-blob/node_modules/@vercel/blob/dist/chunk-IDKCY4S2.js:162:15)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async eval (webpack-internal:///(rsc)/./node_modules/@payloadcms/storage-vercel-blob/node_modules/@vercel/blob/dist/chunk-IDKCY4S2.js:194:31)
at async requestApi (webpack-internal:///(rsc)/./node_modules/@payloadcms/storage-vercel-blob/node_modules/@vercel/blob/dist/chunk-IDKCY4S2.js:181:23)
at async put (webpack-internal:///(rsc)/./node_modules/@payloadcms/storage-vercel-blob/node_modules/@vercel/blob/dist/chunk-IDKCY4S2.js:701:22)
at async Object.eval [as handleUpload] (webpack-internal:///(rsc)/./node_modules/@payloadcms/storage-vercel-blob/dist/handleUpload.js:12:24)
at async eval (webpack-internal:///(rsc)/./node_modules/@payloadcms/plugin-cloud-storage/dist/hooks/beforeChange.js:38:21)
at async Promise.all (index 0)
at async eval (webpack-internal:///(rsc)/./node_modules/@payloadcms/plugin-cloud-storage/dist/hooks/beforeChange.js:46:17)
at async createOperation (webpack-internal:///(rsc)/./node_modules/payload/dist/collections/operations/create.js:145:24)
at async createHandler (webpack-internal:///(rsc)/./node_modules/payload/dist/collections/endpoints/create.js:28:17)
at async handleEndpoints (webpack-internal:///(rsc)/./node_modules/payload/dist/utilities/handleEndpoints.js:178:26)
at async eval (webpack-internal:///(rsc)/./node_modules/@payloadcms/next/dist/routes/rest/index.js:27:20)
...
POST /api/media?depth=0&fallback-locale=null 500 in 456msIt does create the file on vercel blob storage. But not in the correct "manual-battery-charger" directory, but as a file in the blobs root directory like this: "manual-battery-chargerfile_name.pdf".
And somehow payloadcms doesn't register that file creation and doesn't create a new media document for it. I can see it though on the vercel blob storage website.
I am at a loss on how to tackle this. Help would be much appreciated!
Link to the code that reproduces this issue
NA
Reproduction Steps
NA
Which area(s) are affected? (Select all that apply)
plugin: cloud-storage
Environment Info
Binaries:
Node: 22.16.0
npm: 10.9.2
Yarn: N/A
pnpm: 10.11.0
Relevant Packages:
payload: 3.39.1
next: 15.3.2
@payloadcms/db-mongodb: 3.39.1
@payloadcms/email-nodemailer: 3.39.1
@payloadcms/graphql: 3.39.1
@payloadcms/next/utilities: 3.39.1
@payloadcms/payload-cloud: 3.39.1
@payloadcms/plugin-cloud-storage: 3.39.1
@payloadcms/plugin-import-export: 3.39.1
@payloadcms/richtext-lexical: 3.39.1
@payloadcms/storage-vercel-blob: 3.39.1
@payloadcms/translations: 3.39.1
@payloadcms/ui/shared: 3.39.1
react: 19.1.0
react-dom: 19.1.0
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 24.4.0: Fri Apr 11 18:32:43 PDT 2025; root:xnu-11417.101.15~117/RELEASE_ARM64_T8103
Available memory (MB): 8192
Available CPU cores: 8
Metadata
Metadata
Assignees
Labels
No labels