payload: Upgrading from 2.0.10 to >= 2.0.11 introduces a type error which appears to be related to the text field??

Link to reproduction

No response

Describe the Bug

All is working correctly in 2.0.10. All version above this (tried up to latest 2.2.1) maintain this introduced error.

I have no idea how to fix or why this has happened. My front-end is dead, and the collection queries within payload’s admin are also screwed, suggesting this is deeper problem.

Here is the terminal error (see end of report for screenshot of network error from admin ui):

yarn run v1.22.19
$ cross-env NODE_ENV=development PAYLOAD_CONFIG_PATH=src/payload.config.ts ts-node src/dev.ts
[10:45:53] INFO (payload): Connected to MongoDB server successfully!
[10:45:53] INFO (payload): Starting Payload...
[10:45:53] INFO (payload): Payload Admin URL: http://10.0.1.236:3000/admin
Server listening on 3000...
 ○ compiling /[...slug] ...
webpack built 781d5c02f208788ab590 in 11736ms
WARNING in ./src/lib/payload.ts 226:16-28
export 'default' (imported as 'payload') was not found in 'payload' (possible exports: __esModule, webpackBundler)

WARNING in ./src/lib/payload.ts 257:16-28
export 'default' (imported as 'payload') was not found in 'payload' (possible exports: __esModule, webpackBundler)

WARNING in ./src/lib/payload.ts 288:16-28
export 'default' (imported as 'payload') was not found in 'payload' (possible exports: __esModule, webpackBundler)

WARNING in ./src/lib/payload.ts 308:16-34
export 'default' (imported as 'payload') was not found in 'payload' (possible exports: __esModule, webpackBundler)

WARNING in ./src/lib/payload.ts 365:24-40
export 'default' (imported as 'payload') was not found in 'payload' (possible exports: __esModule, webpackBundler)

WARNING in ./src/lib/payload.ts 410:35-51
export 'default' (imported as 'payload') was not found in 'payload' (possible exports: __esModule, webpackBundler)

WARNING in ./src/lib/payload.ts 700:24-36
export 'default' (imported as 'payload') was not found in 'payload' (possible exports: __esModule, webpackBundler)

WARNING in ./src/lib/payload.ts 733:24-36
export 'default' (imported as 'payload') was not found in 'payload' (possible exports: __esModule, webpackBundler)

webpack compiled with 8 warnings
 ✓ Compiled /[...slug] in 6.3s (1084 modules)
[BABEL] Note: The code generator has deoptimised the styling of /Users/jake/Development/personal/elkliandhart.com/.next/server/vendor-chunks/next.js as it exceeds the max of 500KB.
[BABEL] Note: The code generator has deoptimised the styling of /Users/jake/Development/personal/elkliandhart.com/.next/server/pages/_app.js as it exceeds the max of 500KB.
[BABEL] Note: The code generator has deoptimised the styling of /Users/jake/Development/personal/elkliandhart.com/.next/server/pages/[...slug].js as it exceeds the max of 500KB.
 X src/pages/_app.tsx (220:29) @ map
 X TypeError: Cannot read properties of undefined (reading 'map')
    at eval (webpack-internal:///./src/pages/_app.tsx:250:36)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Promise.all (index 3)
    at async Function.MyApp.getInitialProps (webpack-internal:///./src/pages/_app.tsx:182:81)
    at async s (/Users/jake/Development/personal/elkliandhart.com/node_modules/next/dist/compiled/next-server/pages.runtime.dev.js:1:32573)
    at async We (/Users/jake/Development/personal/elkliandhart.com/node_modules/next/dist/compiled/next-server/pages.runtime.dev.js:1:55076)
    at async doRender (/Users/jake/Development/personal/elkliandhart.com/node_modules/next/src/server/base-server.ts:2107:18)
    at async cacheEntry.responseCache.get.incrementalCache.incrementalCache (/Users/jake/Development/personal/elkliandhart.com/node_modules/next/src/server/base-server.ts:2366:24)
    at async /Users/jake/Development/personal/elkliandhart.com/node_modules/next/src/server/response-cache/index.ts:129:28 {
  page: '/_next/webpack-hmr'
}
  218 |         return {
  219 |           ...journal,
> 220 |           docs: journal.docs.map((doc: JournalType) => {
      |                             ^
  221 |             // Remove these, spread the ...rest back into the object.
  222 |             const { layout, ...rest } = doc || {};
  223 |             return {
[10:46:09] ERROR (payload): TypeError: Cannot read properties of undefined (reading 'payload')
    at forEach (/Users/jake/Development/personal/elkliandhart.com/node_modules/@payloadcms/richtext-slate/src/data/richTextRelationshipPromise.ts:38:32)
    at Array.forEach (<anonymous>)
    at recurseRichText (/Users/jake/Development/personal/elkliandhart.com/node_modules/@payloadcms/richtext-slate/src/data/richTextRelationshipPromise.ts:36:26)
    at richTextRelationshipPromise (/Users/jake/Development/personal/elkliandhart.com/node_modules/@payloadcms/richtext-slate/src/data/richTextRelationshipPromise.ts:136:3)
    at Object.afterReadPromise (/Users/jake/Development/personal/elkliandhart.com/node_modules/@payloadcms/richtext-slate/src/index.ts:37:43)
    at promise (/Users/jake/Development/personal/elkliandhart.com/node_modules/payload/src/fields/hooks/afterRead/promise.ts:157:42)
    at forEach (/Users/jake/Development/personal/elkliandhart.com/node_modules/payload/src/fields/hooks/afterRead/traverseFields.ts:45:14)
    at Array.forEach (<anonymous>)
    at traverseFields (/Users/jake/Development/personal/elkliandhart.com/node_modules/payload/src/fields/hooks/afterRead/traverseFields.ts:43:10)
    at promise (/Users/jake/Development/personal/elkliandhart.com/node_modules/payload/src/fields/hooks/afterRead/promise.ts:418:21)
    at forEach (/Users/jake/Development/personal/elkliandhart.com/node_modules/payload/src/fields/hooks/afterRead/traverseFields.ts:45:14)
    at Array.forEach (<anonymous>)
    at traverseFields (/Users/jake/Development/personal/elkliandhart.com/node_modules/payload/src/fields/hooks/afterRead/traverseFields.ts:43:10)
    at promise (/Users/jake/Development/personal/elkliandhart.com/node_modules/payload/src/fields/hooks/afterRead/promise.ts:280:21)
    at /Users/jake/Development/personal/elkliandhart.com/node_modules/payload/src/fields/hooks/afterRead/traverseFields.ts:45:14

Collections with errors (there are others, but these are indicative).

Screenshot 2023-11-23 at 10 36 51 Screenshot 2023-11-23 at 10 37 05

Collection working correctly

Screenshot 2023-11-23 at 10 37 27

Please look into why this error has been introduced and not affecting others. Let me know what else I can supply to help you bugfix.

FYI @DanRibbens has access to this repo already (dev branch).

To Reproduce

Install version >=2.0.11 on my codebase.

Payload Version

Working is 2.0.10. Breaking is >= 2.0.11

Adapters and Plugins

db-mongodb, stripePlugin, webpackBundler, slateEditor

About this issue

  • Original URL
  • State: closed
  • Created 7 months ago
  • Comments: 19 (9 by maintainers)

Most upvoted comments

Did you also check for duplicate payload installs in your node modules? That’s been happening more frequently recently

Checked, and no duplicates here.

Hey @jakehopking I’m gonna jump on this right away with the team. At first blush I can’t see anything that would have changed here causing this, but @DanRibbens and I will work together to try and recreate the issue immediately.

Thanks @jmikrut — I hope you can help me to find the cause! I mentioned above @DanRibbens has access to this repo from long ago. If you checkout, then make sure to keep to main branch and restore the monogdb backup that’s in the repo.