Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested blocks error with localization on Postgres DB #6974

Open
PeterRygeBestseller opened this issue Jun 28, 2024 · 0 comments
Open

Nested blocks error with localization on Postgres DB #6974

PeterRygeBestseller opened this issue Jun 28, 2024 · 0 comments
Labels
status: needs-triage Possible bug which hasn't been reproduced yet v2

Comments

@PeterRygeBestseller
Copy link

PeterRygeBestseller commented Jun 28, 2024

Link to reproduction

https://github.com/PeterRygeBestseller/payload-block-test

Describe the Bug

When blocks are nested in a collection with localization enabled, it gives an error when saving the block on more than 1 locale.
I've only experienced this error with Postgres.
I get the following error in the console:

ERROR (payload): TypeError: Cannot read properties of undefined (reading 'categories_blocks_widget_pkey')
    at upsertRow (C:\git\payload-block-test\node_modules\@payloadcms\db-postgres\src\upsertRow\index.ts:318:57)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at Object.updateOne (C:\git\payload-block-test\node_modules\@payloadcms\db-postgres\src\update.ts:44:18)
    at updateByID (C:\git\payload-block-test\node_modules\payload\src\collections\operations\updateByID.ts:273:16)
    at updateByIDHandler (C:\git\payload-block-test\node_modules\payload\src\collections\requestHandlers\updateByID.ts:43:17)

I run a postgres db with the following docker compose:

version: '3.8'

services:
  postgres:
    container_name: postgres
    image: postgres:14
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: example
      PGDATA: /data/postgres
    volumes:
        - postgres_data:/data/postgres
    ports:
      - 5432:5432
    restart: unless-stopped

volumes:
  postgres_data:

To Reproduce

Create a new category with a row and a widget, click save draft and publish afterwards.
Now go to the second locale on the same category and add a row and a widget again and click save draft and publish. An error will be thrown when clicking publish.

Payload Version

2.22.2

Adapters and Plugins

db-postgres

@PeterRygeBestseller PeterRygeBestseller added status: needs-triage Possible bug which hasn't been reproduced yet v2 labels Jun 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs-triage Possible bug which hasn't been reproduced yet v2
Projects
None yet
Development

No branches or pull requests

1 participant