contentlayerdev / contentlayer

Contentlayer turns your content into data - making it super easy to import MD(X) and CMS content in your app
https://www.contentlayer.dev
MIT License
3.27k stars 200 forks source link

An interrupt was produced by #39 #668

Open vilkinsons opened 1 month ago

vilkinsons commented 1 month ago

When running pnpm run dev I get the following error, which prevents the dev server from evenstarting:

Contentlayer config change detected. Updating type definitions and data... This error shouldn't have happened.

I'm trying to use Contentlayer with Next.js 14.2.5 (app router). Here's the corresponding stack trace:

╥
╠══╦══╗
║  ║  ║
║  ║  ╠─An interrupt was produced by #39.
║  ║  ║ 
║  ║  ▼
║  ║
║  ╠─An unchecked error was produced.
║  ║ 
║  ║ TypeError: Cannot read properties of undefined (reading 'type')
║  ║     at fieldListItemsToCoreFieldListDefItems (file:///Users/D/Git/vilkinsons/vilkinsons.com/node_modules/.pnpm/@contentlayer+source-files@0.3.4_esbuild@0.18.20/node_modules/@contentlayer/source-files/src/schema/provideSchema.ts:248:28)
║  ║     at fieldDefEntryToCoreFieldDef (file:///Users/D/Git/vilkinsons/vilkinsons.com/node_modules/.pnpm/@contentlayer+source-files@0.3.4_esbuild@0.18.20/node_modules/@contentlayer/source-files/src/schema/provideSchema.ts:159:13)
║  ║     at file:///Users/D/Git/vilkinsons/vilkinsons.com/node_modules/.pnpm/@contentlayer+source-files@0.3.4_esbuild@0.18.20/node_modules/@contentlayer/source-files/src/schema/provideSchema.ts:26:9
║  ║     at Array.map (<anonymous>)
║  ║     at next (file:///Users/D/Git/vilkinsons/vilkinsons.com/node_modules/.pnpm/@contentlayer+source-files@0.3.4_esbuild@0.18.20/node_modules/@contentlayer/source-files/src/schema/provideSchema.ts:25:70)
║  ║     at Generator.next (<anonymous>)
║  ║     at ISuspend.factory (file:///Users/D/Git/vilkinsons/vilkinsons.com/node_modules/.pnpm/@effect-ts+system@0.57.5/node_modules/@effect-ts/system/_src/Effect/gen.ts:135:28)
║  ║     at FiberContext.evaluateNow (file:///Users/D/Git/vilkinsons/vilkinsons.com/node_modules/.pnpm/@effect-ts+system@0.57.5/node_modules/@effect-ts/system/_src/Fiber/context.ts:1173:51)
║  ║     at file:///Users/D/Git/vilkinsons/vilkinsons.com/node_modules/.pnpm/@effect-ts+system@0.57.5/node_modules/@effect-ts/system/_src/Fiber/context.ts:576:33
║  ║     at file:///Users/D/Git/vilkinsons/vilkinsons.com/node_modules/.pnpm/@effect-ts+system@0.57.5/node_modules/@effect-ts/system/_src/Support/Scheduler/index.ts:15:9
║  ║ 
║  ║ Fiber: #41 (started at: 2024-08-05T07:26:03.063Z) was supposed to continue to: <empty trace>
║  ║ 
║  ║ Fiber: #41 (started at: 2024-08-05T07:26:03.063Z) Execution trace: <empty trace>
║  ║ 
║  ║ Fiber: #41 (started at: 2024-08-05T07:26:03.063Z) was spawned by:
║  ║ 
║  ║ Fiber: #39 (started at: 2024-08-05T07:26:03.062Z) was supposed to continue to: <empty trace>
║  ║ 
║  ║ Fiber: #39 (started at: 2024-08-05T07:26:03.062Z) Execution trace: <empty trace>
║  ║ 
║  ║ Fiber: #39 (started at: 2024-08-05T07:26:03.062Z) was spawned by:
║  ║ 
║  ║ Fiber: #37 (started at: 2024-08-05T07:26:03.062Z) was supposed to continue to: <empty trace>
║  ║ 
║  ║ Fiber: #37 (started at: 2024-08-05T07:26:03.062Z) Execution trace: <empty trace>
║  ║ 
║  ║ Fiber: #37 (started at: 2024-08-05T07:26:03.062Z) was spawned by:
║  ║ 
║  ║ Fiber: #26 (started at: 2024-08-05T07:26:03.058Z) was supposed to continue to: <empty trace>
║  ║ 
║  ║ Fiber: #26 (started at: 2024-08-05T07:26:03.058Z) Execution trace: <empty trace>
║  ║ 
║  ║ Fiber: #26 (started at: 2024-08-05T07:26:03.058Z) was spawned by:
║  ║ 
║  ║ Fiber: #5 (started at: 2024-08-05T07:26:02.755Z) was supposed to continue to: <empty trace>
║  ║ 
║  ║ Fiber: #5 (started at: 2024-08-05T07:26:02.755Z) Execution trace: <empty trace>
║  ║ 
║  ║ Fiber: #5 (started at: 2024-08-05T07:26:02.755Z) was spawned by:
║  ║ 
║  ║ Fiber: #0 (started at: 2024-08-05T07:26:02.746Z) was supposed to continue to: <empty trace>
║  ║ 
║  ║ Fiber: #0 (started at: 2024-08-05T07:26:02.746Z) Execution trace: <empty trace>
║  ║ 
║  ║ Fiber: #0 (started at: 2024-08-05T07:26:02.746Z) was spawned by: <empty trace>
║  ▼
▼

OS: darwin 23.6.0 (arch: arm64)
Process: /Users/D/.local/share/fnm/node-versions/v20.15.1/installation/bin/node /Users/D/Git/vilkinsons/vilkinsons.com/node_modules/.pnpm/next@14.2.5_@opentelemetry+api@1.9.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/server/lib/start-server.js
Node version: v20.15.1
Contentlayer version: 0.3.4

This is a newly-bootstrapped project, with some example content thrown in the contentlayer.config.ts file and a package.json which contains:

 "dependencies": {
    "contentlayer": "^0.3.4",
    "date-fns": "^3.6.0",
    "next": "14.2.5",
    "next-contentlayer": "^0.3.4",
    "react": "^18.3.1",
    "react-dom": "^18.3.1"
  },
  "devDependencies": {
    "@types/node": "^20.14.14",
    "@types/react": "^18.3.3",
    "@types/react-dom": "^18.3.0",
    "eslint": "^8.57.0",
    "eslint-config-next": "14.2.5",
    "typescript": "^5.5.4"
  }

If I can usefully provide any more information, please let me know.

I suspect my issue relates to (if not is duplicative of) https://github.com/contentlayerdev/contentlayer/issues/659

TranslatorDlique commented 1 month ago

Any solution to this yet? I'm having the same issue. For me it seems to be related to trying to set up images. in the docs it's set up like this for the contentlayer.config:

fields: { image: { type: string }, },

But that throws the error

ReferenceError: string is not defined

When I change is to

fields: { image: { type: "string" }, },

I get the exact same error. I've tried this using 0.3.4 and 0.3.2 using Node v16.17.0