next-learn icon indicating copy to clipboard operation
next-learn copied to clipboard

Chapter 6 localhost:3000/seed not work

Open oSlavivna opened this issue 1 year ago • 6 comments

localhost:3000/seed not download

image I think the database is empty, without tables

How are fill it?

oSlavivna avatar Sep 06 '24 09:09 oSlavivna

I started the deployed project on vercel.com. And there use /seed address. It works. It didnt work on my localhost

nimithaprasad avatar Sep 06 '24 18:09 nimithaprasad

I started the deployed project on vercel.com. And there use /seed address. It works. It didnt work on my localhost

https://next-test-****.vercel**/seed.**app
I add /seed to vercel address - isn`t work((

oSlavivna avatar Sep 06 '24 18:09 oSlavivna

Read this in july of this year, some ppl talked about this issue https://github.com/vercel/next-learn/issues/803 Maybe try to click in the ^ button at the end of the box with the placeholder 'Choose a table' But as said, in the link I provided, some ppl talked about the same issue, and most of them fixed it

codesthenos avatar Sep 07 '24 07:09 codesthenos

in route.ts , from GET function remove the first return and restart the app, don't forget to go to the seed route

jemiks avatar Sep 07 '24 10:09 jemiks

I started the deployed project on vercel.com. And there use /seed address. It works. It didnt work on my localhost

https://next-test-****.vercel**/seed.**app I add /seed to vercel address - isn`t work((

  • uncomment functions inside route.ts file

  • comment or remove the first return inside the GET function inside the route.ts file

export async function GET() {
  // return Response.json({
  //   message:
  //     "Uncomment this file and remove this line. You can delete this file when you are finished.",
  // });
  try {
    await client.sql`BEGIN`;
    await seedUsers();
    await seedCustomers();
    await seedInvoices();
    await seedRevenue();
    await client.sql`COMMIT`;
    return Response.json({ message: "Database seeded successfully" });
  } catch (error) {
    await client.sql`ROLLBACK`;
    return Response.json({ error }, { status: 500 });
  }
}

laza6030 avatar Sep 08 '24 12:09 laza6030

great

superdev2693 avatar Sep 12 '24 23:09 superdev2693