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

Localized group Field breaks Postgres #8308

Closed italodr closed 1 week ago

italodr commented 1 week ago

Link to reproduction

https://github.com/italodr/test-payload-19092024

Environment Info

Binaries:
  Node: 20.12.2
  npm: 10.5.0
  Yarn: 1.22.22
  pnpm: 9.1.2
Relevant Packages:
  payload: 3.0.0-beta.107
  next: 15.0.0-canary.104
  @payloadcms/db-postgres: 3.0.0-beta.107
  @payloadcms/email-nodemailer: 3.0.0-beta.107
  @payloadcms/graphql: 3.0.0-beta.107
  @payloadcms/next/utilities: 3.0.0-beta.107
  @payloadcms/plugin-cloud: 3.0.0-beta.107
  @payloadcms/richtext-lexical: 3.0.0-beta.107
  @payloadcms/translations: 3.0.0-beta.107
  @payloadcms/ui/shared: 3.0.0-beta.107
  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 24.0.0: Mon Aug 12 20:52:31 PDT 2024; root:xnu-11215.1.10~2/RELEASE_ARM64_T6030
  Available memory (MB): 18432
  Available CPU cores: 11

Describe the Bug

I am trying to create a collection with some fields. When I add a field of type upload, there is no problem. But if I try to put this field inside a field of type group, the terminal stops with the following error:

ERROR: Error: cannot connect to Postgres: Cannot read properties of undefined (reading 'notNull')

Screenshot 2024-09-19 at 16 25 15

Reproduction Steps

To reproduce the bug:

  1. Clone the repository
  2. Run dev script
  3. Open: http://localhost:3000/admin
  4. Check the console

To verify that it works if it is applied to the field instead of to the group:

  1. Go to src > globals > header.ts
  2. Move line 16 inside the upload field config
  3. Run dev script
  4. Open: http://localhost:3000/admin

The reproduction repository has been created with:

npx create-payload-app@beta

And the following configuration has been added to payload.config.ts file:

{
  ...
  localization: {
    locales: [
      { code: 'de', label: 'Deutsch' },
      { code: 'es', label: 'Español' },
    ],
    defaultLocale: 'de',
    fallback: false,
  },
  globals: [Header],
  ...
}

Adapters and Plugins

db-postgres

r1tsuu commented 1 week ago

Hey @italodr, thank you! Fix is here: https://github.com/payloadcms/payload/pull/8355, should be in the next release.

github-actions[bot] commented 1 week ago

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

github-actions[bot] commented 4 days ago

🚀 This is included in version v3.0.0-beta.109