The first run of cca3113 failed because /events (and likely every other
DB-backed page) does its DB query during Next's static pre-render,
hitting the stub DATABASE_URL with ECONNREFUSED.
Two options to fix:
A) Mark every DB-backed page `export const dynamic = "force-dynamic"`.
Real fix, but it's a prod-behavior change (every request re-fetches
instead of serving cached HTML).
B) Drop `next build` from CI and rely on Vercel's deploy build —
which has a real DB attached — to catch build issues.
Going with B. Pre-commit + CI now gate type/lint (cheap, fast,
DB-independent); Vercel gates build (slow, DB-aware). Layered checks,
each at the right place.
If the DB-time-of-render coupling becomes a problem later — e.g. a
contributor breaks the build but Vercel doesn't deploy that branch —
revisit and add postgres-service + drizzle-push to the workflow.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Pre-commit (bceacc8) catches local commits, but anything pushed with
--no-verify or arriving via a PR from a fork bypasses it. Add a
GitHub Actions workflow that runs the same checks on origin (push to
main and every PR) plus a `next build` to catch issues that only
surface during compilation.
- Node 22 with npm cache (subsequent runs reuse node_modules)
- Concurrency: cancels in-progress runs on the same ref so quick
commit chains don't waste minutes
- DATABASE_URL is set to a syntactically-valid stub so src/db/index.ts
doesn't throw at module-load; postgres-js pools lazily, no real
connection happens during build
Belt-and-suspenders with the husky hook and Vercel's own build —
covers the case where Vercel is down or the PR author skipped local
hooks.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>