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:
parent
8499d90c2e
commit
d7b35d9544
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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'
|
||||
|
|
|
|||
Loading…
Reference in New Issue