--- a/src/lib/catalog.ts +++ b/src/lib/catalog.ts @@ -1,3 +1,8 @@ import { prisma } from "@/lib/db"; + +// During `next build`, Next evaluates generateStaticParams/generateMetadata for +// each route, which calls these DB readers. No database exists in the sandboxed +// Nix build, so short-circuit them here; the live site fetches real rows/request. +const BUILD = process.env.NEXT_PHASE === "phase-production-build"; export type TierWithFeatures = { @@ -33,2 +38,3 @@ export async function getActiveTiers(): Promise { + if (BUILD) return []; const tiers = await prisma.tier.findMany({ @@ -45,4 +51,5 @@ export async function getTierBySlug( slug: string, ): Promise { + if (BUILD) return null; const tier = await prisma.tier.findUnique({ @@ -58,2 +65,3 @@ export async function getDocPages() { + if (BUILD) return []; return prisma.docPage.findMany({ @@ -65,2 +73,3 @@ export async function getDocBySlug(slug: string) { + if (BUILD) return null; return prisma.docPage.findUnique({ where: { slug } });