fix: mark dynamic routes as force-dynamic to prevent static generation errors

Next.js build was failing because routes using headers() were being
statically generated during build time. Added `export const dynamic = 'force-dynamic'`
to:
- /api/player-stats (uses getViewerId which reads headers)
- /api/debug/active-players (uses getViewerId which reads headers)
- /opengraph-image (reads filesystem during render)

Build errors:
- Route /api/player-stats couldn't be rendered statically because it used `headers`
- Route /api/debug/active-players couldn't be rendered statically because it used `headers`
- Error occurred prerendering page "/opengraph-image"

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Thomas Hallock 2025-11-03 11:08:54 -06:00
parent 8499d90c2e
commit d7b35d9544
3 changed files with 7 additions and 0 deletions

View File

@ -4,6 +4,9 @@ import { getActivePlayers } from '@/lib/arcade/player-manager'
import { db, schema } from '@/db'
import { eq } from 'drizzle-orm'
// Force dynamic rendering - this route uses headers()
export const dynamic = 'force-dynamic'
/**
* GET /api/debug/active-players
* Debug endpoint to check active players for current user

View File

@ -7,6 +7,9 @@ import { players } from '@/db/schema/players'
import type { GetAllPlayerStatsResponse, PlayerStatsData } from '@/lib/arcade/stats/types'
import { getViewerId } from '@/lib/viewer'
// Force dynamic rendering - this route uses headers()
export const dynamic = 'force-dynamic'
/**
* GET /api/player-stats
*

View File

@ -4,6 +4,7 @@ import { join } from 'path'
// Route segment config
export const runtime = 'nodejs'
export const dynamic = 'force-dynamic'
// Image metadata
export const alt = 'Abaci.One - Interactive Soroban Learning Platform'