payload icon indicating copy to clipboard operation
payload copied to clipboard

Error upload asset to a Media collection when relatedTo as field in another collection

Open codedawi opened this issue 1 year ago • 2 comments

Describe the Bug

Logging error when trying to upload asset to a Media collection that is linked to another collection as a field. Everything seems to process properly and UI does not crash but the following error is logged.

Happens when trying create new and editing Media collection item from relatedTo collection.

[09:13:05] ERROR: Error: Could not find field schema for given path "undefined"
    at buildFormState (webpack-internal:///(rsc)/./node_modules/@payloadcms/ui/dist/utilities/buildFormState.js:81:11)
    at Object.buildFormState [as form-state] (webpack-internal:///(rsc)/./node_modules/@payloadcms/next/dist/routes/rest/buildFormState.js:21:113)
    at eval (webpack-internal:///(rsc)/./node_modules/@payloadcms/next/dist/routes/rest/index.js:589:45)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Link to the code that reproduces this issue

https://github.com/codedawi/payload-v3-media-bug

Reproduction Steps

Configure Media collections of upload type. Configure People collections with field profile that links to media upload type. Create new or Edit People collection and then click to upload profile.

On redirect to the Media page upload for profile field it will through this error in the logs. Page seems to function fine though. This error is ONLY happens when being redirected to linked Media field from different collection (uploading Media directly to that collection doesn't result in error.

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

area: ui

Environment Info

Payload: 3.0.0-beta.118 Next.js: 15.0.1

codedawi avatar Oct 25 '24 14:10 codedawi

I am also experiencing the same issue -- when trying to upload asset to a Media collection that is linked to another collection as a field.

Payload: 3.0.0-beta.125 Next: 15.0.0

Is there a fix for this?

alexmacdonell avatar Nov 08 '24 16:11 alexmacdonell

This issue has been marked as stale due to lack of activity.

To keep this issue open, please indicate that it is still relevant in a comment below.

github-actions[bot] avatar Dec 13 '24 05:12 github-actions[bot]

This issue was automatically closed due to lack of activity.

github-actions[bot] avatar Dec 21 '24 05:12 github-actions[bot]

Closing as cannot reproduce on latest version 3.25.0.

jessrynkar avatar Mar 04 '25 13:03 jessrynkar

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

github-actions[bot] avatar Mar 12 '25 05:03 github-actions[bot]