payloadcms / payload

Payload is the open-source, fullstack Next.js framework, giving you instant backend superpowers. Get a full TypeScript backend and admin panel instantly. Use Payload as a headless CMS or for building powerful applications.
https://payloadcms.com
MIT License
23.57k stars 1.5k forks source link

payload-locked-documents error on every CMS client action #8418

Closed bowendevteam closed 4 days ago

bowendevteam commented 5 days ago

Link to reproduction

No response

Environment Info

Binaries:
  Node: 18.20.4
  npm: 10.7.0
  Yarn: N/A
  pnpm: 8.12.1
Relevant Packages:
  payload: 3.0.0-canary.0374de4
  next: 15.0.0-canary.104
  @payloadcms/db-mongodb: 3.0.0-canary.0374de4
  @payloadcms/db-postgres: 3.0.0-canary.0374de4
  @payloadcms/graphql: 3.0.0-canary.0374de4
  @payloadcms/next/utilities: 3.0.0-canary.0374de4
  @payloadcms/richtext-lexical: 3.0.0-canary.0374de4
  @payloadcms/richtext-slate: 3.0.0-canary.0374de4
  @payloadcms/translations: 3.0.0-canary.0374de4
  @payloadcms/ui/shared: 3.0.0-canary.0374de4
  react: 19.0.0-rc-06d0b89e-20240801
  react-dom: 19.0.0-rc-06d0b89e-20240801
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.5.0: Wed May  1 20:14:38 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6020
  Available memory (MB): 196608
  Available CPU cores: 24

Describe the Bug

payload-locked-documents error on every CMS client action

I first noticed it only when radio buttons to conditionally show fields didn't work, but now I am noticing that on every single keypress or client action in the CMS there is a 400 form state error.

"collection": "payload-locked-documents", "errors": [ { "field": "document", "message": "This relationship field has the following invalid relationships: [object Object] 0" } ]

I tried stripping down my collection configuration to a single plain text field and I am still seeing the error on the client every keypress.

I even tried a complete fresh install and I am still getting the same errors. I have provided the simplest steps I can below to reproduce

Reproduction Steps

1. git clone git@github.com:payloadcms/payload-3.0-demo.git
2. cd payload-3.0-demo
3. cp .env.local.example .env.local
4. ran pnpm i
5. uncommented POSTGRES_URI variable and filled in the proper ip for my local machine
6. opened start-database.sh file
7. changed source .env to source .env.local
8. changed $DATABASE_URL to $POSTGRES_URI
9. ran ./start-database.sh
10. changed database in payload config to use postgres adapter
11. ran pnpm dev
12. visited http://localhost:3000/admin and signed in with test credentials from onInit
13. created a page, filled in data for title and content fields
14. saved the page
15. Now while starting to type again in the fields I get the errors on every single keypress

Screenshot 2024-09-25 at 9 21 30 AM Screenshot 2024-09-25 at 9 21 42 AM

Adapters and Plugins

db-postgres, storage-vercel-blob

r1tsuu commented 4 days ago

Hey @bowendevteam, the demo repository hasn't been updated yet and it's on 3.0.0-canary.0374de4 version which meant for the internal usage and can include bugs. Indeed, I reproduced the same from it, but it seems to be fixed on the latest version 3.0.0-beta.108.

You can either try to update Payload packages by running pnpx create-payload-app@beta in the repo (then you'll also need to update next / react) or create a new project from website template with the same command outside of the repo.

DanRibbens commented 4 days ago

I've updated the demo to beta.108 for anyone else cloning it down.

bowendevteam commented 4 days ago

I can confirm everything works now. Thank you. Just out of curiosity is this repo meant to reflect the latest while still in beta and moving forward? Or would you recommend that people don't use this and use the cli instead?

github-actions[bot] commented 2 days ago

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