-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Open
Labels
status: needs-triagePossible bug which hasn't been reproduced yetPossible bug which hasn't been reproduced yet
Description
Describe the Bug
Description
When clientUploads: true is enabled in s3Storage plugin, the initial create request (Next.js Server Action) still includes the full file binary in the multipart form data. This causes a 413 Payload Too Large error due to Next.js's default 1MB limit for Server Actions, defeating the purpose of client-side uploads.
Reproducible Code
// payload.config.ts
plugins: [
s3Storage({
collections: {
media: {
generateFileURL: ({ filename }) => `${process.env.FRONTEND_URL}/images/${filename}`,
},
},
clientUploads: true,
bucket: process.env.R2_BUCKET_NAME || '',
config: {
credentials: {
accessKeyId: process.env.R2_ACCESS_KEY_ID || '',
secretAccessKey: process.env.R2_SECRET_ACCESS_KEY || '',
},
region: 'auto',
endpoint: process.env.R2_ENDPOINT || '',
},
}),
],
Link to the code that reproduces this issue
https://github.com/du2333/payloadcms-reproduction-repo
Reproduction Steps
- Enable s3Storage with clientUploads: true.
- Upload a file larger than 1MB (e.g., 5MB) via the Admin UI.
- Observe the 413 error in the console.
- Check the Network tab: the /admin/collections/media/create POST request contains the file binary.
Which area(s) are affected?
plugin: storage-*
Environment Info
Binaries:
Node: 22.15.0
npm: 10.9.2
Yarn: N/A
pnpm: 10.25.0
Relevant Packages:
payload: 3.69.0
next: 15.4.10
@payloadcms/db-postgres: 3.69.0
@payloadcms/drizzle: 3.69.0
@payloadcms/graphql: 3.69.0
@payloadcms/next/utilities: 3.69.0
@payloadcms/plugin-cloud-storage: 3.69.0
@payloadcms/plugin-seo: 3.69.0
@payloadcms/richtext-lexical: 3.69.0
@payloadcms/storage-s3: 3.69.0
@payloadcms/translations: 3.69.0
@payloadcms/ui/shared: 3.69.0
react: 19.2.1
react-dom: 19.2.1
Operating System:
Platform: linux
Arch: x64
Version: #1 SMP Tue Nov 5 00:21:55 UTC 2024
Available memory (MB): 15951
Available CPU cores: 16
Metadata
Metadata
Assignees
Labels
status: needs-triagePossible bug which hasn't been reproduced yetPossible bug which hasn't been reproduced yet