payloadcms / payloadcms/payload

Bug with "Copy to locale" on globals

Open
#16,747 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area: core area: ui db: mongodb stale status: needs-triage v3
Dominant language
TypeScript
Stars
44.8k
Forks
4.2k
Avg merge
2d 21h
Merged PRs (30d)
53

Description

Describe the Bug

When trying to use "copy to locale" on any global i get the following error:

    err: {
      "type": "TypeError",
      "message": "Cannot read properties of undefined (reading 'config')",
      "stack":
          TypeError: Cannot read properties of undefined (reading 'config')
              at copyDataFromLocale (C:\git\payload-test\.next\dev\server\chunks\ssr\node_modules_@payloadcms_ui_dist_06ysd6i._.js:4679:53)
              at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
              at async copyDataFromLocaleHandler (C:\git\payload-test\.next\dev\server\chunks\ssr\node_modules_@payloadcms_ui_dist_06ysd6i._.js:4622:16)
              at async executeActionAndPrepareForRender (C:\git\payload-test\node_modules\next\dist\compiled\next-server\app-page-turbo.runtime.dev.js:64:5248)
              at async C:\git\payload-test\node_modules\next\dist\compiled\next-server\app-page-turbo.runtime.dev.js:64:1986
              at async handleAction (C:\git\payload-test\node_modules\next\dist\compiled\next-server\app-page-turbo.runtime.dev.js:62:25386)
              at async renderToHTMLOrFlightImpl (C:\git\payload-test\node_modules\next\dist\compiled\next-server\app-page-turbo.runtime.dev.js:69:55695)
              at async doRender (C:\git\payload-test\.next\dev\server\chunks\ssr\node_modules_117v_f-._.js:3638:28)
              at async AppPageRouteModule.handleResponse (C:\git\payload-test\node_modules\next\dist\compiled\next-server\app-page-turbo.runtime.dev.js:71:66429)
              at async handleResponse (C:\git\payload-test\.next\dev\server\chunks\ssr\node_modules_117v_f-._.js:3949:32)
              at async Module.handler (C:\git\payload-test\.next\dev\server\chunks\ssr\node_modules_117v_f-._.js:4355:20)
              at async DevServer.renderToResponseWithComponentsImpl (C:\git\payload-test\node_modules\next\dist\server\base-server.js:1462:9)
              at async DevServer.renderPageComponent (C:\git\payload-test\node_modules\next\dist\server\base-server.js:1514:24)
              at async DevServer.renderToResponseImpl (C:\git\payload-test\node_modules\next\dist\server\base-server.js:1564:32)
              at async DevServer.pipeImpl (C:\git\payload-test\node_modules\next\dist\server\base-server.js:1044:25)
              at async NextNodeServer.handleCatchallRenderRequest (C:\git\payload-test\node_modules\next\dist\server\next-server.js:338:17)
              at async DevServer.handleRequestImpl (C:\git\payload-test\node_modules\next\dist\server\base-server.js:935:17)
              at async C:\git\payload-test\node_modules\next\dist\server\dev\next-dev-server.js:394:20
              at async Span.traceAsyncFn (C:\git\payload-test\node_modules\next\dist\trace\trace.js:164:20)
              at async DevServer.handleRequest (C:\git\payload-test\node_modules\next\dist\server\dev\next-dev-server.js:390:24)
              at async invokeRender (C:\git\payload-test\node_modules\next\dist\server\lib\router-server.js:266:21)
              at async handleRequest (C:\git\payload-test\node_modules\next\dist\server\lib\router-server.js:465:24)
              at async requestHandlerImpl (C:\git\payload-test\node_modules\next\dist\server\lib\router-server.js:514:13)
              at async Server.requestListener (C:\git\payload-test\node_modules\next\dist\server\lib\start-server.js:225:13)
    }
⨯ TypeError: Cannot read properties of undefined (reading 'config')
    at ignore-listed frames {
  digest: '2467349392'
}
 POST /admin/globals/header?locale=en 500 in 406ms (next.js: 4ms, application-code: 403ms)
  └─ ƒ <inline action>({"args":{"fromLocale":"en","globalSlug":"header","overrideData":true,"...":"1 item not stringified"},"name":"copy-data-from-locale"}) in 28ms src/app/(payload)/layout.tsx

Looks like it might be the same bug or similar to this: https://github.com/payloadcms/payload/issues/16455

Link to the code that reproduces this issue

https://github.com/PeterRygeBestseller/payload-test/tree/global-copy-to-locale-bug

Reproduction Steps

The linked repository can be used to reproduce the error using a MongoDB database.
Use the global Header to test it.

Which area(s) are affected?

db: mongodb, area: ui, area: core

Environment Info
Binaries:
  Node: 26.2.0
  npm: N/A
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  payload: 3.84.1
  next: 16.2.6
  @payloadcms/db-mongodb: 3.84.1
  @payloadcms/email-nodemailer: 3.84.1
  @payloadcms/graphql: 3.84.1
  @payloadcms/next/utilities: 3.84.1
  @payloadcms/payload-cloud: 3.84.1
  @payloadcms/translations: 3.84.1
  @payloadcms/ui/shared: 3.84.1
  react: 19.2.6
  react-dom: 19.2.6
Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 10 IoT Enterprise LTSC 2021
  Available memory (MB): 65461
  Available CPU cores: 24

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Use the linked reproduction repository and its global Header to reproduce the failure with MongoDB. Start at the copyDataFromLocale and copyDataFromLocaleHandler entry points named in the stack trace, then compare the global copy-to-locale path with the referenced issue. Done means copying a global to a locale no longer returns a 500 and the copied data is available.

Written by the indexing model from the issue text.

Assessment

Tech stack
mongodb, next.js, typescript
Domain
backend, databases, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.