payload icon indicating copy to clipboard operation
payload copied to clipboard

Folders: Passing folder override function crashes payload

Open cgilly2fast opened this issue 11 months ago • 1 comments

Describe the Bug

When using a function in the folders.collectionOverrides configuration, Payload throws a Next.js serialization error: "Functions cannot be passed directly to Client Components unless you explicitly expose it by marking it with 'use server'."

Link to the code that reproduces this issue

https://github.com/cgilly2fast/payload-blank

Reproduction Steps

pnpm dev in reproduction repo

Go to /admin

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

area: core

Environment Info

payload: 3.40.0
    next: 15.3.0

cgilly2fast avatar May 31 '25 06:05 cgilly2fast

Please add a reproduction in order for us to be able to investigate.

Depending on the quality of reproduction steps, this issue may be closed if no reproduction is provided.

Why was this issue marked with the invalid-reproduction label?

To be able to investigate, we need access to a reproduction to identify what triggered the issue. We prefer a link to a public GitHub repository created with create-payload-app@latest -t blank or a forked/branched version of this repository with tests added (more info in the reproduction-guide).

To make sure the issue is resolved as quickly as possible, please make sure that the reproduction is as minimal as possible. This means that you should remove unnecessary code, files, and dependencies that do not contribute to the issue. Ensure your reproduction does not depend on secrets, 3rd party registries, private dependencies, or any other data that cannot be made public. Avoid a reproduction including a whole monorepo (unless relevant to the issue). The easier it is to reproduce the issue, the quicker we can help.

Please test your reproduction against the latest version of Payload to make sure your issue has not already been fixed.

I added a link, why was it still marked?

Ensure the link is pointing to a codebase that is accessible (e.g. not a private repository). "example.com", "n/a", "will add later", etc. are not acceptable links -- we need to see a public codebase. See the above section for accepted links.

Useful Resources

github-actions[bot] avatar May 31 '25 06:05 github-actions[bot]

Image

I am using "use server" to fix this

Aqib-Rime avatar Jun 02 '25 10:06 Aqib-Rime

🚀 This is included in version v3.41.0

github-actions[bot] avatar Jun 05 '25 14:06 github-actions[bot]

This issue has been automatically locked. Please open a new issue if this issue persists with any additional detail.

github-actions[bot] avatar Jun 13 '25 05:06 github-actions[bot]