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.

Fields of type 'list' break everything but 'json' and 'string' work

See original GitHub issue

I’m busy trying to implement Contentlayers on a site with a lot of mdx files as the content for a blog. When I use the type: 'list' property in a field everything breaks.

`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 interrupt was produced by #16. β•‘ β•‘ β•‘ β•‘ β•‘ β–Ό β•‘ β•‘ β•‘ ╠─An unchecked error was produced. β•‘ β•‘ β•‘ β•‘ TypeError: Cannot read properties of undefined (reading β€˜type’) β•‘ β•‘ at fieldListItemsToCoreFieldListDefItems (file:///workspace/avif.io/node_modules/@contentlayer/source-files/src/schema/provideSchema.ts:251:28) β•‘ β•‘ at fieldDefEntryToCoreFieldDef (file:///workspace/avif.io/node_modules/@contentlayer/source-files/src/schema/provideSchema.ts:159:13) β•‘ β•‘ at file:///workspace/avif.io/node_modules/@contentlayer/source-files/src/schema/provideSchema.ts:26:9 β•‘ β•‘ at Array.map (<anonymous>) β•‘ β•‘ at next (file:///workspace/avif.io/node_modules/@contentlayer/source-files/src/schema/provideSchema.ts:25:64) β•‘ β•‘ at Generator.next (<anonymous>) β•‘ β•‘ at ISuspend.factory (file:///workspace/avif.io/node_modules/@effect-ts/system/_src/Effect/gen.ts:135:28) β•‘ β•‘ at FiberContext.evaluateNow (file:///workspace/avif.io/node_modules/@effect-ts/system/_src/Fiber/context.ts:1173:51) β•‘ β•‘ at file:///workspace/avif.io/node_modules/@effect-ts/system/_src/Fiber/context.ts:576:33 β•‘ β•‘ at file:///workspace/avif.io/node_modules/@effect-ts/system/_src/Support/Scheduler/index.ts:15:9 β•‘ β•‘ β•‘ β•‘ Fiber: #18 (started at: 2022-04-24T14:08:00.132Z) was supposed to continue to: β•‘ β•‘ β•‘ β•‘ a future continuation at packages/@contentlayer/source-files/src/index.ts:104:19 β•‘ β•‘ β•‘ β•‘ Fiber: #18 (started at: 2022-04-24T14:08:00.132Z) Execution trace: β•‘ β•‘ β•‘ β•‘ packages/@contentlayer/source-files/src/schema/provideSchema.ts:18:8 β•‘ β•‘ β•‘ β•‘ Fiber: #18 (started at: 2022-04-24T14:08:00.132Z) was spawned by: β•‘ β•‘ β•‘ β•‘ Fiber: #16 (started at: 2022-04-24T14:08:00.132Z) was supposed to continue to: β•‘ β•‘ β•‘ β•‘ a future continuation at packages/@contentlayer/core/src/generation/generate-dotpkg.ts:82:13 β•‘ β•‘ β•‘ β•‘ Fiber: #16 (started at: 2022-04-24T14:08:00.132Z) Execution trace: β•‘ β•‘ β•‘ β•‘ packages/@contentlayer/core/src/generation/generate-dotpkg.ts:78:16 β•‘ β•‘ β•‘ β•‘ Fiber: #16 (started at: 2022-04-24T14:08:00.132Z) was spawned by: β•‘ β•‘ β•‘ β•‘ Fiber: #14 (started at: 2022-04-24T14:08:00.129Z) was supposed to continue to: <empty trace> β•‘ β•‘ β•‘ β•‘ Fiber: #14 (started at: 2022-04-24T14:08:00.129Z) Execution trace: <empty trace> β•‘ β•‘ β•‘ β•‘ Fiber: #14 (started at: 2022-04-24T14:08:00.129Z) was spawned by: β•‘ β•‘ β•‘ β•‘ Fiber: #10 (started at: 2022-04-24T14:08:00.128Z) was supposed to continue to: <empty trace> β•‘ β•‘ β•‘ β•‘ Fiber: #10 (started at: 2022-04-24T14:08:00.128Z) Execution trace: <empty trace> β•‘ β•‘ β•‘ β•‘ Fiber: #10 (started at: 2022-04-24T14:08:00.128Z) was spawned by: β•‘ β•‘ β•‘ β•‘ Fiber: #3 (started at: 2022-04-24T14:07:59.958Z) was supposed to continue to: <empty trace> β•‘ β•‘ β•‘ β•‘ Fiber: #3 (started at: 2022-04-24T14:07:59.958Z) Execution trace: β•‘ β•‘ β•‘ β•‘ packages/next-contentlayer/src/plugin.ts:17:94 β•‘ β•‘ packages/@contentlayer/utils/src/effect/Stream.ts:32:83 β•‘ β•‘ packages/@contentlayer/core/src/getConfig/index.ts:192:13 β•‘ β•‘ packages/@contentlayer/core/src/getConfig/index.ts:181:28 β•‘ β•‘ packages/@contentlayer/core/src/getConfig/index.ts:179:44 β•‘ β•‘ packages/@contentlayer/core/src/getConfig/index.ts:166:28 β•‘ β•‘ packages/@contentlayer/core/src/getConfig/index.ts:164:31 β•‘ β•‘ packages/@contentlayer/core/src/getConfig/index.ts:151:28 β•‘ β•‘ packages/@contentlayer/core/src/getConfig/index.ts:149:15 β•‘ β•‘ packages/@contentlayer/core/src/getConfig/index.ts:146:15 β•‘ β•‘ packages/@contentlayer/core/src/getConfig/index.ts:145:15 β•‘ β•‘ packages/@contentlayer/core/src/cwd.ts:24:43 β•‘ β•‘ packages/@contentlayer/core/src/getConfig/index.ts:134:27 β•‘ β•‘ packages/@contentlayer/core/src/getConfig/index.ts:121: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-04-24T14:07:59.958Z) was spawned by: β•‘ β•‘ β•‘ β•‘ Fiber: #0 (started at: 2022-04-24T14:07:59.943Z) was supposed to continue to: <empty trace> β•‘ β•‘ β•‘ β•‘ Fiber: #0 (started at: 2022-04-24T14:07:59.943Z) Execution trace: β•‘ β•‘ β•‘ β•‘ packages/@contentlayer/utils/src/tracing-effect/index.ts:45:45 β•‘ β•‘ packages/@contentlayer/core/src/cwd.ts:22: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:23:32 β•‘ β•‘ packages/@contentlayer/core/src/runMain.ts:14:12 β•‘ β•‘ β•‘ β•‘ Fiber: #0 (started at: 2022-04-24T14:07:59.943Z) was spawned by: <empty trace> β•‘ β–Ό β–Ό

OS: linux 5.16.20-051620-generic (arch: x64) Process: /home/gitpod/.nvm/versions/node/v16.14.2/bin/node /workspace/avif.io/node_modules/.bin/next dev Node version: v16.14.2 Contentlayer version: 0.2.4`

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7

github_iconTop GitHub Comments

3reactions
schicklingcommented, May 9, 2022

Sorry about the confusion in case you ran into a problem like described above. This isn’t technically a problem with Contentlayer itself but rather occurs when β€œwrongly using it”. (Thanks @sidwebworks for pointing out the solution to the described problem.)

In order to improve the DX for future users running into a similar situation, I’m planning to implement Runtime config / schema validation functionality (see #214).

0reactions
sidwebworkscommented, May 9, 2022

You need to add the of property in the field

of: {
  type: 'string',
},
Read more comments on GitHub >

github_iconTop Results From Across the Web

Are multi-line strings allowed in JSON? - Stack Overflow
JSON does not allow real line-breaks. You need to replace all the line breaks with \n . eg: "first line second line". can...
Read more >
How JSON Array of String Works? (Examples) - eduCBA
So on a whole, the 'JSON array of strings' represents an ordered list of values, and It can store multiple values. This is...
Read more >
Working With JSON Data in Python
In this tutorial you'll learn how to read and write JSON-encoded data using Python. You'll see hands-on examples of working with Python's built-in...
Read more >
JSON.stringify() - JavaScript - MDN Web Docs
The JSON.stringify() method converts a JavaScript value to a JSON string, optionally replacing values if a replacer function is specified orΒ ...
Read more >
Surprises and Gotchas When Working With JSON
Surprises and Gotchas When Working With JSON Β· Map entries are sorted alphabetically Β· Byte slices are encoded as base-64 strings Β· Nil...
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