Fix Vercel build: force-dynamic on all API routes #3991
Cross-repo impact
See what breaks downstream if this PR merges.
⮌ Merged
This pull request was merged into main.
c comment · e edit title · m merge · a approve · r request changes · ? shortcuts
Originally written by @ccantynz-alt on GitHub.
Imported from https://github.com/ccantynz-alt/48co.v1/pull/46
Next.js was trying to prerender API routes as static pages during build, which fails because they need database connections and env vars that aren't available at build time.
Added
export const dynamic = "force-dynamic"to all 10 API routes. This tells Next.js to only run them at request time, never at build.https://claude.ai/code/session_01PBeNmPHrD2W6A2YKZRC7V3