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.33k stars 201 forks source link

This error shouldn't have happened. Please consider opening a GitHub issue with the stack trace below here: #673

Open Souravvmishra opened 1 day ago

Souravvmishra commented 1 day ago
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 #39.
║  ║  ║
║  ║  ▼
║  ║
║  ╠─An unchecked error was produced.
║  ║
║  ║ Error: A case was not handled for value: {"type":"object","fields":{"twitter":{"type":"string","required":true},"github":{"type":"string","required":true},"linkedIn":{"type":"string","required":true}},"required":true}
║  ║     at Module.casesHandled (file:///C:/Users/soura/OneDrive/Desktop/meetman-02/node_modules/@contentlayer/utils/src/index.ts:85:9)
║  ║     at fieldDefEntryToCoreFieldDef (file:///C:/Users/soura/OneDrive/Desktop/meetman-02/node_modules/@contentlayer/source-files/src/schema/provideSchema.ts:240:13)
║  ║     at file:///C:/Users/soura/OneDrive/Desktop/meetman-02/node_modules/@contentlayer/source-files/src/schema/provideSchema.ts:26:9
║  ║     at Array.map (<anonymous>)
║  ║     at next (file:///C:/Users/soura/OneDrive/Desktop/meetman-02/node_modules/@contentlayer/source-files/src/schema/provideSchema.ts:25:70)
║  ║     at Generator.next (<anonymous>)
║  ║     at ISuspend.factory (file:///C:/Users/soura/OneDrive/Desktop/meetman-02/node_modules/@effect-ts/system/_src/Effect/gen.ts:135:28)
║  ║     at FiberContext.evaluateNow (file:///C:/Users/soura/OneDrive/Desktop/meetman-02/node_modules/@effect-ts/system/_src/Fiber/context.ts:1173:51)
║  ║     at file:///C:/Users/soura/OneDrive/Desktop/meetman-02/node_modules/@effect-ts/system/_src/Fiber/context.ts:576:33
║  ║     at file:///C:/Users/soura/OneDrive/Desktop/meetman-02/node_modules/@effect-ts/system/_src/Support/Scheduler/index.ts:15:9
║  ║
║  ║ Fiber: #41 (started at: 2024-11-13T17:41:32.299Z) was supposed to continue to: <empty trace>
║  ║
║  ║ Fiber: #41 (started at: 2024-11-13T17:41:32.299Z) Execution trace: <empty trace>      
║  ║
║  ║ Fiber: #41 (started at: 2024-11-13T17:41:32.299Z) was spawned by:
║  ║
║  ║ Fiber: #39 (started at: 2024-11-13T17:41:32.298Z) was supposed to continue to: <empty trace>
║  ║
║  ║ Fiber: #39 (started at: 2024-11-13T17:41:32.298Z) Execution trace: <empty trace>      
║  ║
║  ║ Fiber: #39 (started at: 2024-11-13T17:41:32.298Z) was spawned by:
║  ║
║  ║ Fiber: #37 (started at: 2024-11-13T17:41:32.296Z) was supposed to continue to: <empty trace>
║  ║
║  ║ Fiber: #37 (started at: 2024-11-13T17:41:32.296Z) Execution trace: <empty trace>      
║  ║
║  ║ Fiber: #37 (started at: 2024-11-13T17:41:32.296Z) was spawned by:
║  ║
║  ║ Fiber: #26 (started at: 2024-11-13T17:41:32.278Z) was supposed to continue to: <empty trace>
║  ║
║  ║ Fiber: #26 (started at: 2024-11-13T17:41:32.278Z) Execution trace: <empty trace>      
║  ║
║  ║ Fiber: #26 (started at: 2024-11-13T17:41:32.278Z) was spawned by:
║  ║
║  ║ Fiber: #5 (started at: 2024-11-13T17:41:31.441Z) was supposed to continue to: <empty trace>
║  ║
║  ║ Fiber: #5 (started at: 2024-11-13T17:41:31.441Z) Execution trace: <empty trace>       
║  ║
║  ║ Fiber: #5 (started at: 2024-11-13T17:41:31.441Z) was spawned by:
║  ║
║  ║ Fiber: #0 (started at: 2024-11-13T17:41:31.428Z) was supposed to continue to: <empty trace>
║  ║
║  ║ Fiber: #0 (started at: 2024-11-13T17:41:31.428Z) Execution trace: <empty trace>       
║  ║
║  ║ Fiber: #0 (started at: 2024-11-13T17:41:31.428Z) was spawned by: <empty trace>        
║  ▼
▼

OS: win32 10.0.22635 (arch: x64)
Process: C:\Users\soura\node_modules\node\bin\node.exe C:\Users\soura\OneDrive\Desktop\meetman-02\node_modules\next\dist\server\lib\start-server.js
Node version: v22.10.0
Contentlayer version: 0.3.4

This happened when I added the followoing

export const Author = defineDocumentType(() => ({
  name: "Author",
  filePathPattern: `authors/**/*.mdx`,
  contentType: "mdx",
  fields: {
    name: {
      type: "string",
      required: true,
    },
    jobTitle: {
      type: "string",
      required: true,
    },
    about: {
      type: "string",
      required: true,
    },
    image: {
      type: "string",
      required: true,
    },
    twitter: {
      type: "string",
      required: true
    },
    socialLinks: {
      type: "object",
      fields: {
        twitter: { type: "string", required: true },
        github: { type: "string", required: true },
        linkedIn: { type: "string", required: true }
      },
      required: true
    },
    workExperience: {
      type: "list",
      of: {
        type: "object",
        fields: {
          title: { type: "string", required: true },
          company: { type: "string", required: true },
          year: { type: "number", required: true }
        }
      },
      required: true
    },
    contact: {
      type: "object", 
      fields: {
        address: { type: "string", required: true },
        phone: { type: "string", required: true },
        email: { type: "string", required: true }
      },
      required: true
    }
  },
  computedFields,
}))

It was working fine earlier

export const Author = defineDocumentType(() => ({
  name: "Author",
  filePathPattern: `authors/**/*.mdx`,
  contentType: "mdx",
  fields: {
    name: {
      type: "string",
      required: true,
    },
    jobTitle: {
      type: "string",
      required: true,
    },
    about: {
      type: "string",
      required: true,
    },
    image: {
      type: "string",
      required: true,
    },
    twitter: {
      type: "string",
      required: true
    },
    socialLinks: {
      type: "object",
      fields: {
        twitter: { type: "string", required: true },
        github: { type: "string", required: true },
        linkedIn: { type: "string", required: true }
      },
      required: true
    },
    workExperience: {
      type: "list",
      of: {
        type: "object",
        fields: {
          title: { type: "string", required: true },
          company: { type: "string", required: true },
          year: { type: "number", required: true }
        }
      },
      required: true
    },
    contact: {
      type: "object", 
      fields: {
        address: { type: "string", required: true },
        phone: { type: "string", required: true },
        email: { type: "string", required: true }
      },
      required: true
    }
  },
  computedFields,
}))
SanyamPunia commented 1 day ago

Can you share your package.json?