payloadcms / payloadcms/payload

Memory leak when using multiple collections in a cloud storage plugin

Open
#16,039 1 comment 5 reactions 1 assignee View on GitHub

@AlessioGr is already working on this.

Since Apr 23, 2026.

area: core Bug stale
Dominant language
TypeScript
Stars
44.8k
Forks
4.2k
Avg merge
2d 21h
Merged PRs (30d)
53

Description

Describe the Bug

When multiple collections are used in a cloud storage plugin configuration, initClientUploads.js causes a memory leak that crashes the browser tab or even freezes the computer.

s3Storage({ collections: [ ExampleCollection, ExampleCollection, ExampleCollection, ExampleCollection, ExampleCollection, ExampleCollection, ExampleCollection, ExampleCollection, ExampleCollection, ExampleCollection, ExampleCollection, ExampleCollection, ExampleCollection, ExampleCollection, ExampleCollection, ExampleCollection, ExampleCollection, ExampleCollection, ExampleCollection, ExampleCollection, ], ...

Link to the code that reproduces this issue

https://github.com/gerardpuig/payload-storage-plugin-crash/commit/ddcb27029f5e095e8c28d046fc83a7c052003364

Reproduction Steps
Which area(s) are affected?

area: core

Environment Info
Binaries:
  Node: 24.14.0
  npm: 11.9.0
  Yarn: N/A
  pnpm: 10.32.1
Relevant Packages:
  payload: 3.80.0
  next: 16.2.1
  @payloadcms/db-mongodb: 3.80.0
  @payloadcms/graphql: 3.80.0
  @payloadcms/next/utilities: 3.80.0
  @payloadcms/plugin-cloud-storage: 3.80.0
  @payloadcms/richtext-lexical: 3.80.0
  @payloadcms/storage-s3: 3.80.0
  @payloadcms/translations: 3.80.0
  @payloadcms/ui/shared: 3.80.0
  react: 19.2.2
  react-dom: 19.2.2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.