Skip to content

S3 Uploads Slow Over Time and Eventually Timeout with payloadcms/storage-s3 #12366

@prxssh

Description

@prxssh

Describe the Bug

We’re running Payload CMS in a Kubernetes cluster and using the payloadcms/storage-s3 adapter to handle media uploads. We recently upgraded from v3.0.0-beta.106 to v3.37.0, and since then, on pod startup uploads to S3 are fast and reliable—but after several hours of continuous use, upload latency increases dramatically and requests begin failing with 504 Gateway Timeout. Restarting the pod immediately restores normal performance.

This is the storage-s3 config that we're using:

 s3Storage({
      collections: {
        media: {
          prefix: 'cms/media/',
        },
      },
      bucket: process.env.S3_BUCKET || '',
      config: {
        credentials: {
          accessKeyId: process.env.S3_ACCESS_KEY || '',
          secretAccessKey: process.env.S3_SECRET || '',
        },
        forcePathStyle: true,
        region: process.env.S3_REGION || '',
      },
    })

Link to the code that reproduces this issue

N.A

Reproduction Steps

I was unable to reproduce the issue using a minimal template project. However, I’m attaching two videos: the first shows normal performance immediately after the server starts, and the second shows the performance regression over time.

  1. Payload Working Fine
  2. Payload Media Uploads/Downloads Failing

Which area(s) are affected? (Select all that apply)

plugin: cloud-storage, Not sure

Environment Info

Binaries:
  Node: 20.18.1
  npm: 10.8.2
  Yarn: 1.22.22
  pnpm: N/A
Relevant Packages:
  payload: 3.37.0
  next: 15.3.1
  @payloadcms/db-mongodb: 3.37.0
  @payloadcms/graphql: 3.37.0
  @payloadcms/next/utilities: 3.37.0
  @payloadcms/plugin-cloud-storage: 3.37.0
  @payloadcms/plugin-seo: 3.37.0
  @payloadcms/richtext-lexical: 3.37.0
  @payloadcms/richtext-slate: 3.37.0
  @payloadcms/storage-s3: 3.37.0
  @payloadcms/translations: 3.37.0
  @payloadcms/ui/shared: 3.37.0
  react: 19.1.0
  react-dom: 19.1.0
Operating System:
  Platform: linux
  Arch: arm64
  Version: #1 SMP Tue Feb 11 11:41:18 UTC 2025
  Available memory (MB): 3817
  Available CPU cores: 2

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: needs-triagePossible bug which hasn't been reproduced yet

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions