From 8790a4f65a4a6771642fd3b22d69fae3c989b7df Mon Sep 17 00:00:00 2001 From: asepharyana Date: Wed, 19 Aug 2026 22:56:01 +0700 Subject: [PATCH] fix(web): render content pages dynamically so next build needs no DB MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The home, doc, and search pages queried Postgres during SSG/static data collection, so 'next build' failed in CI (no DB). Mark them force-dynamic (and drop generateStaticParams from the doc page) so they render at request time — instant at this corpus scale and build-safe without a live database. --- apps/web/app/[section]/[...slug]/page.tsx | 14 ++++++-------- apps/web/app/page.tsx | 4 ++++ apps/web/app/search/page.tsx | 4 ++++ 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/apps/web/app/[section]/[...slug]/page.tsx b/apps/web/app/[section]/[...slug]/page.tsx index c335a76..d268cce 100644 --- a/apps/web/app/[section]/[...slug]/page.tsx +++ b/apps/web/app/[section]/[...slug]/page.tsx @@ -3,6 +3,12 @@ import { notFound } from "next/navigation"; import { getDocument, listDocuments, getRelated, listRevisions } from "@mcpedia/core"; import Markdown from "@/components/Markdown"; +// Render at request time. The content lives in Postgres (populated by the +// indexer/worker), which is not available at build time (CI has no DB), so we +// opt out of static generation. At this corpus scale request-time rendering is +// instant. +export const dynamic = "force-dynamic"; + export default async function DocPage({ params, }: { @@ -80,11 +86,3 @@ export default async function DocPage({ ); } - -export async function generateStaticParams() { - const docs = await listDocuments(); - return docs.map((d) => ({ - section: d.section, - slug: d.slug.split("/").slice(1), - })); -} diff --git a/apps/web/app/page.tsx b/apps/web/app/page.tsx index 0e11b06..d426e6f 100644 --- a/apps/web/app/page.tsx +++ b/apps/web/app/page.tsx @@ -2,6 +2,10 @@ import Link from "next/link"; import { listDocuments } from "@mcpedia/core"; import type { DocumentMeta } from "@mcpedia/core"; +// Render at request time — content is in Postgres (not available at build in +// CI, which has no DB). Request-time rendering is instant at this corpus scale. +export const dynamic = "force-dynamic"; + const SECTIONS = ["docs", "writeups", "research", "notes"] as const; export default async function Home() { diff --git a/apps/web/app/search/page.tsx b/apps/web/app/search/page.tsx index 175d52d..9d9c77a 100644 --- a/apps/web/app/search/page.tsx +++ b/apps/web/app/search/page.tsx @@ -1,6 +1,10 @@ import Link from "next/link"; import { keywordSearch, hybridSearch } from "@mcpedia/core"; +// Render at request time — queries Postgres on each request (not at build, +// where CI has no DB). +export const dynamic = "force-dynamic"; + type Mode = "keyword" | "hybrid"; export default async function SearchPage({