question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bumping from 0.2.7 to 0.2.8 breaks with Cannot read properties of undefined (reading 'name')

See original GitHub issue

When bumping contentlayer from 0.2.7 to 0.2.8 I get the following error. 0.2.7 just works fine. Running with next 12.2.5 on node 16.

$ yarn dev
yarn run v1.22.19
$ next dev
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
info  - Loaded env from /Users/marco/code/priv/nextjs-blog/.env
info  - SWC minify release candidate enabled. https://nextjs.link/swcmin
This error shouldn't have happened. Please consider opening a GitHub issue with the stack trace below here:
https://github.com/contentlayerdev/contentlayer/issues

An unchecked error was produced.

TypeError: Cannot read properties of undefined (reading 'name')
    at IncompatibleFieldDataError.renderLine (file:///Users/marco/code/priv/nextjs-blog/node_modules/@contentlayer/source-files/src/errors/index.ts:353:74)
    at file:///Users/marco/code/priv/nextjs-blog/node_modules/@contentlayer/source-files/src/errors/aggregate.ts:133:31
    at Array.map (<anonymous>)
    at aggregateFetchDataErrors (file:///Users/marco/code/priv/nextjs-blog/node_modules/@contentlayer/source-files/src/errors/aggregate.ts:133:8)
    at next (file:///Users/marco/code/priv/nextjs-blog/node_modules/@contentlayer/source-files/src/errors/aggregate.ts:34:26)
    at Generator.next (<anonymous>)
    at ISuspend.factory (file:///Users/marco/code/priv/nextjs-blog/node_modules/@effect-ts/system/_src/Effect/gen.ts:135:28)
    at FiberContext.evaluateNow (file:///Users/marco/code/priv/nextjs-blog/node_modules/@effect-ts/system/_src/Fiber/context.ts:1173:51)
    at file:///Users/marco/code/priv/nextjs-blog/node_modules/@effect-ts/system/_src/Fiber/context.ts:576:33
    at file:///Users/marco/code/priv/nextjs-blog/node_modules/@effect-ts/system/_src/Support/Scheduler/index.ts:15:9

Fiber: #28 (started at: 2022-09-14T08:31:19.936Z) was supposed to continue to:

  a future continuation at packages/@contentlayer/source-files/src/fetchData/index.ts:102:21

Fiber: #28 (started at: 2022-09-14T08:31:19.936Z) Execution trace:

  packages/@contentlayer/source-files/src/errors/aggregate.ts:27:8
  packages/@contentlayer/source-files/src/fetchData/fetchAllDocuments.ts:74:15
  packages/@contentlayer/source-files/src/fetchData/fetchAllDocuments.ts:139:37
  packages/@contentlayer/source-files/src/fetchData/fetchAllDocuments.ts:134:8
  packages/@contentlayer/source-files/src/fetchData/fetchAllDocuments.ts:72:43
  packages/@contentlayer/source-files/src/fetchData/fetchAllDocuments.ts:68:16
  packages/@contentlayer/source-files/src/fetchData/fetchAllDocuments.ts:67:16
  packages/@contentlayer/source-files/src/fetchData/fetchAllDocuments.ts:56:24
  packages/@contentlayer/source-files/src/fetchData/fetchAllDocuments.ts:53:49
  packages/@contentlayer/source-files/src/fetchData/fetchAllDocuments.ts:122:10
  packages/@contentlayer/source-files/src/fetchData/fetchAllDocuments.ts:118:22
  packages/@contentlayer/source-files/src/fetchData/fetchAllDocuments.ts:47:44
  packages/@contentlayer/source-files/src/fetchData/fetchAllDocuments.ts:46:10

Fiber: #28 (started at: 2022-09-14T08:31:19.936Z) was spawned by:

Fiber: #24 (started at: 2022-09-14T08:31:19.935Z) was supposed to continue to: <empty trace>

Fiber: #24 (started at: 2022-09-14T08:31:19.935Z) Execution trace: <empty trace>

Fiber: #24 (started at: 2022-09-14T08:31:19.935Z) was spawned by:

Fiber: #23 (started at: 2022-09-14T08:31:19.935Z) was supposed to continue to: <empty trace>

Fiber: #23 (started at: 2022-09-14T08:31:19.935Z) Execution trace: <empty trace>

Fiber: #23 (started at: 2022-09-14T08:31:19.935Z) was spawned by:

Fiber: #22 (started at: 2022-09-14T08:31:19.924Z) was supposed to continue to: <empty trace>

Fiber: #22 (started at: 2022-09-14T08:31:19.924Z) Execution trace:

  packages/@contentlayer/source-files/src/fetchData/index.ts:54:116
  packages/@contentlayer/utils/src/node/fs.ts:90:15
  packages/@contentlayer/utils/src/node/fs.ts:89:72
  packages/@contentlayer/utils/src/node/fs.ts:89:12
  packages/@contentlayer/utils/src/node/fs.ts:17:10
  packages/@contentlayer/utils/src/node/fs.ts:16:60
  packages/@contentlayer/utils/src/node/fs.ts:16:15
  packages/@contentlayer/utils/src/node/fs.ts:31:27
  packages/@contentlayer/core/src/DataCache.ts:51:31
  packages/@contentlayer/core/src/DataCache.ts:50:17
  packages/@contentlayer/core/src/ArtifactsDir.ts:31:12
  packages/@contentlayer/core/src/cwd.ts:23:43
  packages/@contentlayer/utils/src/node/version.ts:21:15
  packages/@contentlayer/utils/src/node/version.ts:20:10
  packages/@contentlayer/utils/src/node/fs.ts:77:17
  packages/@contentlayer/utils/src/node/fs.ts:76:12
  packages/@contentlayer/utils/src/node/fs.ts:45:22
  packages/@contentlayer/core/src/ArtifactsDir.ts:27:15
  packages/@contentlayer/core/src/DataCache.ts:47:38
  packages/@contentlayer/core/src/DataCache.ts:46:12

Fiber: #22 (started at: 2022-09-14T08:31:19.924Z) was spawned by:

Fiber: #17 (started at: 2022-09-14T08:31:19.916Z) was supposed to continue to: <empty trace>

Fiber: #17 (started at: 2022-09-14T08:31:19.916Z) Execution trace:

  packages/@contentlayer/core/src/cwd.ts:23:43
  packages/@contentlayer/core/src/generation/generate-dotpkg.ts:82:13
  packages/@contentlayer/core/src/generation/generate-dotpkg.ts:78:16

Fiber: #17 (started at: 2022-09-14T08:31:19.916Z) was spawned by:

Fiber: #15 (started at: 2022-09-14T08:31:19.914Z) was supposed to continue to: <empty trace>

Fiber: #15 (started at: 2022-09-14T08:31:19.914Z) Execution trace: <empty trace>

Fiber: #15 (started at: 2022-09-14T08:31:19.914Z) was spawned by:

Fiber: #11 (started at: 2022-09-14T08:31:19.913Z) was supposed to continue to: <empty trace>

Fiber: #11 (started at: 2022-09-14T08:31:19.913Z) Execution trace: <empty trace>

Fiber: #11 (started at: 2022-09-14T08:31:19.913Z) was spawned by:

Fiber: #3 (started at: 2022-09-14T08:31:19.081Z) was supposed to continue to: <empty trace>

Fiber: #3 (started at: 2022-09-14T08:31:19.081Z) Execution trace:

  packages/next-contentlayer/src/plugin.ts:21:94
  packages/@contentlayer/utils/src/effect/Stream.ts:32:83
  packages/@contentlayer/core/src/getConfig/index.ts:198:13
  packages/@contentlayer/core/src/getConfig/index.ts:187:28
  packages/@contentlayer/core/src/getConfig/index.ts:185:44
  packages/@contentlayer/core/src/getConfig/index.ts:172:28
  packages/@contentlayer/core/src/getConfig/index.ts:170:31
  packages/@contentlayer/core/src/getConfig/index.ts:157:28
  packages/@contentlayer/core/src/getConfig/index.ts:155:15
  packages/@contentlayer/core/src/getConfig/index.ts:152:15
  packages/@contentlayer/core/src/getConfig/index.ts:151:15
  packages/@contentlayer/core/src/cwd.ts:23:43
  packages/@contentlayer/core/src/getConfig/index.ts:136:27
  packages/@contentlayer/core/src/getConfig/index.ts:123:10
  packages/@contentlayer/core/src/getConfig/esbuild.ts:118:12
  packages/@contentlayer/core/src/getConfig/esbuild.ts:121:14
  packages/@contentlayer/core/src/getConfig/esbuild.ts:70:15
  packages/@contentlayer/core/src/getConfig/esbuild.ts:69:10
  packages/@contentlayer/core/src/getConfig/esbuild.ts:68:10
  packages/@contentlayer/core/src/getConfig/esbuild.ts:51:22
  packages/@contentlayer/core/src/getConfig/esbuild.ts:76:10
  packages/@contentlayer/core/src/getConfig/esbuild.ts:75:12
  packages/@contentlayer/core/src/getConfig/esbuild.ts:75:46
  packages/@contentlayer/core/src/getConfig/esbuild.ts:89:20
  packages/@contentlayer/core/src/getConfig/esbuild.ts:88:12

Fiber: #3 (started at: 2022-09-14T08:31:19.081Z) was spawned by:

Fiber: #0 (started at: 2022-09-14T08:31:19.061Z) was supposed to continue to: <empty trace>

Fiber: #0 (started at: 2022-09-14T08:31:19.061Z) Execution trace:

  packages/@contentlayer/utils/src/tracing-effect/index.ts:49:45
  packages/@contentlayer/core/src/cwd.ts:21:49
  packages/@contentlayer/core/src/cwd.ts:9:18
  packages/@contentlayer/core/src/cwd.ts:8:23
  packages/@contentlayer/core/src/cwd.ts:7:29
  packages/@contentlayer/core/src/runMain.ts:20:32
  packages/@contentlayer/core/src/runMain.ts:15:12

Fiber: #0 (started at: 2022-09-14T08:31:19.061Z) was spawned by: <empty trace>

OS: darwin 21.6.0 (arch: x64)
Process: /usr/local/Cellar/node@16/16.17.0_1/bin/node /Users/marco/code/priv/nextjs-blog/node_modules/.bin/next dev
Node version: v16.17.0
Contentlayer version: 0.2.8

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:1
  • Comments:5

github_iconTop GitHub Comments

1reaction
schicklingcommented, Nov 7, 2022

I’d kindly ask you to try to reproduce the problem in a minimal way (ideally in a new repo) that you can share with me. Otherwise it won’t be feasible for me to further investigate this given my limited time capacity.

0reactions
marcofranssencommented, Nov 11, 2022

Just gave that version a test. This makes it work again with my stuff. Thanks. 🎉

Read more comments on GitHub >

github_iconTop Results From Across the Web

I cannot find the error TypeError: Cannot read properties of ...
Your issue is that your .find() method is returning undefined , so you can't access properties on product such as .name as it...
Read more >
Issues · contentlayerdev/contentlayer - GitHub
Bumping from 0.2.7 to 0.2.8 breaks with Cannot read properties of undefined (reading 'name') bug Something isn't working.
Read more >
Timeline Bug - "cannot read properties of undefined ... - Reddit
Specifically the names of events. Now whenever I am on the website it won't load the Timeline in general. It just pops up...
Read more >
typeorm: CHANGELOG
migration successful now displays name of the migration file (#8904) (49cbe23) ... cannot read properties of undefined (reading 'joinEagerRelations') ...
Read more >
exceljs-enhance - npm
Excel Workbook Manager - Read and Write xlsx and csv Files.. Latest version: 4.3.5, last published: 3 months ago.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found