adrianhajdin / project_next_14_ai_prompt_sharing

Next.js recently became the official React framework as outlined in React docs. In this course, you'll learn the most important Next.js concepts and how they fit into the React ecosystem. Finally, you'll put your skills to the test by building a modern full-stack Next 14 application.
https://www.jsmastery.pro/ultimate-next-course
2.83k stars 416 forks source link

I am getting an error 500 while try to upload prompts in the db. Can anyone have any solution for this problem #82

Closed tanbiralam closed 9 months ago

tanbiralam commented 9 months ago

This is the error I am getting whenever I click the create button with a prompt and a tag.

page.jsx:24

   POST http://localhost:3000/api/prompt/new 500 (Internal Server Error)

image

MongoDB Connected
Error creating prompt: Error: Prompt validation failed: tag: Tag is required
    at ValidationError.inspect (C:\Users\ASUS\Desktop\next-js\share-prompts\node_modules\mongoose\lib\error\validation.js:50:26)       
    at formatValue (node:internal/util/inspect:805:19)
    at inspect (node:internal/util/inspect:364:10)
    at formatWithOptionsInternal (node:internal/util/inspect:2279:40)
    at formatWithOptions (node:internal/util/inspect:2141:10)
    at console.value (node:internal/console/constructor:352:14)
    at console.warn (node:internal/console/constructor:385:61)
    at POST (webpack-internal:///(rsc)/./app/api/prompt/new/route.js:23:17)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async C:\Users\ASUS\Desktop\next-js\share-prompts\node_modules\next\dist\compiled\next-server\app-route.runtime.dev.js:6:63251 {
  errors: {
    tag: ValidatorError: Tag is required     
        at SchemaType.doValidate (C:\Users\ASUS\Desktop\next-js\share-prompts\node_modules\mongoose\lib\schemaType.js:1349:7)
        at C:\Users\ASUS\Desktop\next-js\share-prompts\node_modules\mongoose\lib\document.js:2972:18
        at process.processTicksAndRejections (node:internal/process/task_queues:77:11) {
      properties: [Object],
      kind: 'required',
      path: 'tag',
      value: undefined,
      reason: undefined,
      [Symbol(mongoose#validatorError)]: true    }
  },
  _message: 'Prompt validation failed'
}