code100x / cms

Repo for https://app.100xdevs.com/
https://app.100xdevs.com/
893 stars 1.26k forks source link

bug: when i run project locally it give me this error #982

Open Rahul-Bhati opened 3 weeks ago

Rahul-Bhati commented 3 weeks ago

Screenshot (197)

avayyyyyyy commented 3 weeks ago

We don't have the permission to access the image, that's why

@hkirat

irfan0807 commented 3 weeks ago

Images were in AWS S3 bucket, and those are not shared outside . @hkirat discussed about this in one of the class videos

rajan153 commented 3 weeks ago

anyone can help me to setup this project to my local machine using docker whenever i am setup it then at last command it's giving prisma error the command is npm run build. I am just run this command sudo docker-compose up after clone the repo.

ayushagarwal27 commented 3 weeks ago

@rajan153 you can set local postgreSQL in docker and provide link in .env.example, then run prisma migrate and seed command.

rajan153 commented 3 weeks ago

@ayushagarwal27 i do but nothing is happened.

rajan153 commented 3 weeks ago

@ayushagarwal27 have i need to make postgres manually or using command it will create automatically ? Because i think it creating image for me of postgres

ayushagarwal27 commented 3 weeks ago

@rajan153 can you share screenshot of error ?

You need to make manual postgreSQL instance in your docker container, or get one from neon. Provide that.

rajan153 commented 3 weeks ago

@ayushagarwal27 can i paste the error here ?

ayushagarwal27 commented 3 weeks ago

@rajan153 Sure, better provide screenshot

rajan153 commented 3 weeks ago

@ayushagarwal27

0 156.8 Generating static pages (0/46) ... Generating static pages (11/46) Generating static pages (22/46) Generating static pages (34/46) 0 160.1 ⚠ Entire page /discord/redirect/cohort3 deopted into client-side rendering. https://nextjs.org/docs/messages/deopted-into-client-rendering /discord/redirect/cohort3 0 160.2 ⚠ Entire page /discord/redirect deopted into client-side rendering. https://nextjs.org/docs/messages/deopted-into-client-rendering /discord/redirect 0 160.2 PrismaClientInitializationError: 0 160.2 Invalid prisma.course.findMany() invocation: 0 160.2 0 160.2 0 160.2 error: Error validating datasource db: You must provide a nonempty URL. The environment variable DATABASE_URL resolved to an empty string. 0 160.2 --> schema.prisma:8 0 160.2 | 0 160.2 7 | provider = "postgresql" 0 160.2 8 | url = env("DATABASE_URL") 0 160.2 | 0 160.2 0 160.2 Validation Error Count: 1 0 160.2 at ai.handleRequestError (/usr/src/app/node_modules/@prisma/client/runtime/library.js:126:7075) 0 160.2 at ai.handleAndLogRequestError (/usr/src/app/node_modules/@prisma/client/runtime/library.js:126:6109) 0 160.2 at ai.request (/usr/src/app/node_modules/@prisma/client/runtime/library.js:126:5817) 0 160.2 at async l (/usr/src/app/node_modules/@prisma/client/runtime/library.js:131:9709) 0 160.2 at async i (/usr/src/app/.next/server/app/courses/page.js:1:3318) { 0 160.2 clientVersion: '5.9.1', 0 160.2 errorCode: undefined 0 160.2 } 0 160.2 PrismaClientInitializationError: 0 160.2 Invalid prisma.course.findMany() invocation: 0 160.2 0 160.2 0 160.2 error: Error validating datasource db: You must provide a nonempty URL. The environment variable DATABASE_URL resolved to an empty string. 0 160.2 --> schema.prisma:8 0 160.2 | 0 160.2 7 | provider = "postgresql" 0 160.2 8 | url = env("DATABASE_URL") 0 160.2 | 0 160.2 0 160.2 Validation Error Count: 1 0 160.2 at ai.handleRequestError (/usr/src/app/node_modules/@prisma/client/runtime/library.js:126:7075) 0 160.2 at ai.handleAndLogRequestError (/usr/src/app/node_modules/@prisma/client/runtime/library.js:126:6109) 0 160.2 at ai.request (/usr/src/app/node_modules/@prisma/client/runtime/library.js:126:5817) 0 160.2 at async l (/usr/src/app/node_modules/@prisma/client/runtime/library.js:131:9709) 0 160.2 at async i (/usr/src/app/.next/server/app/courses/page.js:1:3318) { 0 160.2 clientVersion: '5.9.1', 0 160.2 errorCode: undefined 0 160.2 } 0 160.4 0 160.4 Error occurred prerendering page "/courses". Read more: https://nextjs.org/docs/messages/prerender-error 0 160.4 PrismaClientInitializationError: 0 160.4 Invalid prisma.course.findMany() invocation: 0 160.4 0 160.4 0 160.4 error: Error validating datasource db: You must provide a nonempty URL. The environment variable DATABASE_URL resolved to an empty string. 0 160.4 --> schema.prisma:8 0 160.4 | 0 160.4 7 | provider = "postgresql" 0 160.4 8 | url = env("DATABASE_URL") 0 160.4 | 0 160.4 0 160.4 Validation Error Count: 1 0 160.4 at ai.handleRequestError (/usr/src/app/node_modules/@prisma/client/runtime/library.js:126:7075) 0 160.4 at ai.handleAndLogRequestError (/usr/src/app/node_modules/@prisma/client/runtime/library.js:126:6109) 0 160.4 at ai.request (/usr/src/app/node_modules/@prisma/client/runtime/library.js:126:5817) 0 160.4 at async l (/usr/src/app/node_modules/@prisma/client/runtime/library.js:131:9709) 0 160.4 at async i (/usr/src/app/.next/server/app/courses/page.js:1:3318) ✓ Generating static pages (46/46) 0 160.8 0 160.8 > Export encountered errors on following paths: 0 160.8 /courses/page: /courses

failed to solve: process "/bin/sh -c DATABASE_URL=$DATABASE_URL npm run build" did not complete successfully: exit code: 1 Screenshot from 2024-08-23 00-08-52 Screenshot from 2024-08-23 00-09-47

ayushagarwal27 commented 3 weeks ago

@rajan153 make sure you add postgreSQL url in env file,

Error validating datasource db: You must provide a nonempty URL. The environment variable DATABASE_URL resolved to an empty string.

rajan153 commented 3 weeks ago

@ayushagarwal27 yeah, also i added screenshot there is one of env file there i already added postgres link. It making image also of postgres but not working.

ayushagarwal27 commented 3 weeks ago

@rajan153 are you following with docker commands or without docker,

follow without docker one, skip (3) option and provide your own postgrSQL url

rajan153 commented 3 weeks ago

@ayushagarwal27 i am going with docker commands, Okay i will try then i will told you.

Rahul-Bhati commented 3 weeks ago

@avayyyyyyy bro When I click on "View Content," it doesn't load any content.

avayyyyyyy commented 3 weeks ago

@avayyyyyyy bro When I click on "View Content," it doesn't load any content.

Have you run that seed command??

npm run db:seed - this one

Rahul-Bhati commented 2 weeks ago

This is the error after running :npm run db:seed `

  152
  153 async function seedCourseContent() {
  154   try {

→ 155     await db.courseContent.create(
Unique constraint failed on the fields: (`courseId`,`contentId`)

    at ai.handleRequestError (cms\node_modules\@prisma\client\runtime\library.js:126:6775)

    at ai.handleAndLogRequestError (cms\node_modules\@prisma\client\runtime\library.js:126:6109)

    at ai.request (cms\node_modules\@prisma\client\runtime\library.js:126:5817)

    at async l (cms\node_modules\@prisma\client\runtime\library.js:131:9709) {

  code: 'P2002',
  clientVersion: '5.9.1',
  meta: { modelName: 'CourseContent', target: [ 'courseId', 'contentId' ] }
}

An unexpected error occurred during seeding: PrismaClientKnownRequestError:
Invalid `db.courseContent.create()` invocation in

`

VardaanAggarwal commented 2 weeks ago

This is the error after running :npm run db:seed `

  152
  153 async function seedCourseContent() {
  154   try {

→ 155     await db.courseContent.create(
Unique constraint failed on the fields: (`courseId`,`contentId`)

    at ai.handleRequestError (cms\node_modules\@prisma\client\runtime\library.js:126:6775)

    at ai.handleAndLogRequestError (cms\node_modules\@prisma\client\runtime\library.js:126:6109)

    at ai.request (cms\node_modules\@prisma\client\runtime\library.js:126:5817)

    at async l (cms\node_modules\@prisma\client\runtime\library.js:131:9709) {

  code: 'P2002',
  clientVersion: '5.9.1',
  meta: { modelName: 'CourseContent', target: [ 'courseId', 'contentId' ] }
}

An unexpected error occurred during seeding: PrismaClientKnownRequestError:
Invalid `db.courseContent.create()` invocation in

`

this is a unique constraint violation error, common while seeding the databases with random values. I think you should just run it once more and this should not be a problem for you next time

Azathoth-11 commented 2 weeks ago

anyone can help me to setup this project to my local machine using docker whenever i am setup it then at last command it's giving prisma error the command is npm run build. I am just run this command sudo docker-compose up after clone the repo.

have you solved this issue? I am also facing this now.

rajan153 commented 2 weeks ago

anyone can help me to setup this project to my local machine using docker whenever i am setup it then at last command it's giving prisma error the command is npm run build. I am just run this command sudo docker-compose up after clone the repo.

have you solved this issue? I am also facing this now.

not yet, can you tell me which error you are facing ?

Azathoth-11 commented 2 weeks ago

anyone can help me to setup this project to my local machine using docker whenever i am setup it then at last command it's giving prisma error the command is npm run build. I am just run this command sudo docker-compose up after clone the repo.

have you solved this issue? I am also facing this now.

not yet, can you tell me which error you are facing ?

same error as you.

rajan153 commented 2 weeks ago

@Azathoth-11 maybe i will work on it tonight if something happened then i will ping you.

Azathoth-11 commented 2 weeks ago

maybe i will work on it tonight if something happened then i will ping you.

i made it work but not sure if its correct. just pasted the dockerfile.dev to dockerfile

rajan153 commented 2 weeks ago

@Azathoth-11 Thank you brother, It's working fine for me.