fix: render course pages dynamically to avoid production 500#260
Merged
Conversation
The course page reads searchParams (?year=) but declared the static- generation config (generateStaticParams + revalidate=false) copied from /race/[slug]. Touching searchParams in a statically-generated route throws DYNAMIC_SERVER_USAGE at request time, 500ing every /courses/[course] page in production (dev masked it — dev always renders dynamically). Opt into dynamic rendering instead. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LFeozH85YsXjHHbE79Jqs3
rootulp
enabled auto-merge (squash)
July 16, 2026 22:33
The PR-open push did not create a Vercel deployment (likely a dropped webhook during a GitHub 503 window), so the required Vercel status never posted and the PR stayed blocked. Empty commit to re-fire the deployment. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LFeozH85YsXjHHbE79Jqs3
rootulp
disabled auto-merge
July 16, 2026 23:00
rootulp
enabled auto-merge (squash)
July 16, 2026 23:00
rootulp
disabled auto-merge
July 16, 2026 23:01
rootulp
enabled auto-merge (squash)
July 16, 2026 23:01
rootulp
disabled auto-merge
July 16, 2026 23:02
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Every
/courses/[course]page (added in #259) returned a 500 in production — e.g.https://www.tritimes.org/courses/im703-melbourne.Root cause
The page reads
searchParams(?year=) but declared the static-generation config (generateStaticParams+revalidate = false) copied from/race/[slug]. TouchingsearchParamsin a statically-generated route throwsDYNAMIC_SERVER_USAGEat request time, 500ing the page. Dev masked it (dev always renders dynamically); only the production build (which classified the route● SSG) failed./race/[slug]is unaffected because it never readssearchParams.Fix
Opt the route into dynamic rendering (
export const dynamic = "force-dynamic") instead of static generation, since it must be request-time to read?year=. The route now builds asƒ (Dynamic).Testing
Reproduced and verified in production mode (
npm run build && npm start), which is what CI/dev missed:/courses/[course]→ 500 (DYNAMIC_SERVER_USAGE).?year=2023→ 200, nonexistent course/year → 404, zero server-render errors.Note: CI runs
npm run build(which succeeds even with the bug, since the error is request-time) but not a production-mode smoke test, so neither CI nor the dev-mode Playwright e2e caught this. Documented the invariant in a code comment to prevent reverting to the static config.🤖 Generated with Claude Code