Builds without a database are checked before a release #151

Closed
opened 2026-11-06 14:48:29 +01:00 by miko · 1 comment
Owner

Twice a page reached the database while prerendering (#104 broke it, #121/#134 reported it, 14a0fe3 fixed it). Local and e2e builds always have a database, so this only shows in the Docker build at release time (ADR-0014).

Decisions (grilling of #121)

  • npm run build:nodb mirrors the Docker build: DATABASE_URL= KATABA_STANDALONE=1 next build. DATABASE_URL is set to empty, not unset, so Next does not fill it in from .env.
  • Separate output folder: next.config takes distDir from KATABA_DIST_DIR; build:nodb sets .next-nodb (gitignored), so it never touches the dev server's or the e2e build's .next.
  • Clear error in src/db.ts: in the build phase without DATABASE_URL, a Prisma $extends query hook throws on every operation, with a message like "No DATABASE_URL during the build: a page reaches the database while prerendering; await params/cookies first (ADR-0014)". The client is created at import, so the error has to come at query time, not import time. The decision (build phase and no URL) lives in a small pure function with a unit test (TDD seam). With a URL set, no hook: runtime is unchanged.
  • Release skill (.claude/skills/release): npm run build:nodb runs first, before the merge request to master; a failure stops the release. The later docker build stays as the final check.
  • No CI runner, so the release skill is the gate; developers and agents can run build:nodb before merging.
Twice a page reached the database while prerendering (#104 broke it, #121/#134 reported it, 14a0fe3 fixed it). Local and e2e builds always have a database, so this only shows in the Docker build at release time (ADR-0014). ## Decisions (grilling of #121) - **`npm run build:nodb`** mirrors the Docker build: `DATABASE_URL= KATABA_STANDALONE=1 next build`. `DATABASE_URL` is set to empty, not unset, so Next does not fill it in from `.env`. - **Separate output folder**: `next.config` takes `distDir` from `KATABA_DIST_DIR`; `build:nodb` sets `.next-nodb` (gitignored), so it never touches the dev server's or the e2e build's `.next`. - **Clear error in `src/db.ts`**: in the build phase without `DATABASE_URL`, a Prisma `$extends` query hook throws on every operation, with a message like "No DATABASE_URL during the build: a page reaches the database while prerendering; await params/cookies first (ADR-0014)". The client is created at import, so the error has to come at query time, not import time. The decision (build phase and no URL) lives in a small pure function with a unit test (TDD seam). With a URL set, no hook: runtime is unchanged. - **Release skill** (`.claude/skills/release`): `npm run build:nodb` runs first, before the merge request to master; a failure stops the release. The later `docker build` stays as the final check. - No CI runner, so the release skill is the gate; developers and agents can run `build:nodb` before merging.
Author
Owner

Umgesetzt in #153 (feature/151-nodb-build → development): npm run build:nodb baut ohne Datenbank in .next-nodb, db.ts meldet einen Datenbankzugriff beim Vorrendern klar, und der Release-Skill führt den Check als ersten Schritt aus.

Umgesetzt in #153 (feature/151-nodb-build → development): `npm run build:nodb` baut ohne Datenbank in `.next-nodb`, `db.ts` meldet einen Datenbankzugriff beim Vorrendern klar, und der Release-Skill führt den Check als ersten Schritt aus.
miko closed this issue 2026-11-06 14:56:43 +01:00
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MassiveDynamic/kataba#151
No description provided.