diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 52c3fb6..34e8b00 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -1,5 +1,9 @@ generator client { - provider = "prisma-client-js" + provider = "prisma-client-js" + // "native" builds for local dev; "rhel-openssl-3.0.x" is the engine + // Vercel's serverless functions actually run on. Without both, database + // calls crash in production with no useful error message. + binaryTargets = ["native", "rhel-openssl-3.0.x"] } datasource db { diff --git a/src/app/profile/page.tsx b/src/app/profile/page.tsx index 8e15d40..95ff4d8 100644 --- a/src/app/profile/page.tsx +++ b/src/app/profile/page.tsx @@ -11,12 +11,24 @@ export default async function ProfilePage() { redirect("/login"); } - await ensureDb(); - - const user = await prisma.user.findUnique({ - where: { id: session.user.id }, - select: { id: true, name: true, email: true, age: true, bio: true }, - }); + let user; + try { + await ensureDb(); + user = await prisma.user.findUnique({ + where: { id: session.user.id }, + select: { id: true, name: true, email: true, age: true, bio: true }, + }); + } catch (err) { + console.error("failed to load profile:", err); + return ( +
+

Something went wrong

+

+ We couldn't load your profile right now. Please try again in a moment. +

+
+ ); + } if (!user) { redirect("/login");