diff --git a/web/app/my/page.tsx b/web/app/my/page.tsx index cc73ec0..7dfd3a2 100644 --- a/web/app/my/page.tsx +++ b/web/app/my/page.tsx @@ -4,8 +4,11 @@ import { loadHackathons } from "@/lib/listings"; import { MyClient } from "@/components/hq/my-client"; import { isClerkConfigured } from "@/lib/env"; -// ISR: keep deadline-derived status/countdowns fresh without a rebuild (#47). -export const revalidate = 3600; +// /my calls auth(), which reads request headers, so it must render per request: +// combining that with ISR (revalidate) throws DYNAMIC_SERVER_USAGE in a +// production build. force-dynamic also keeps deadline-derived countdowns fresh, +// which is the reason #47 originally set revalidate here. +export const dynamic = "force-dynamic"; export const metadata = { title: "My HackHQ ยท Members Hub", @@ -15,46 +18,13 @@ export const metadata = { export default async function MyPage() { if (isClerkConfigured()) { - let userId: string | null = null; - try { - const authResult = await auth(); - userId = authResult.userId; - // TEMP DIAGNOSTIC: safe metadata only - no tokens/cookies/JWTs/PII. - console.log("CLERK AUTH OK ON /my", { - hasUserId: Boolean(authResult.userId), - hasSessionId: Boolean(authResult.sessionId), - }); - } catch (error) { - // TEMP DIAGNOSTIC: log the ORIGINAL auth exception before Next.js - // sanitizes it in the production Server Components error. - console.error("CLERK AUTH FAILURE ON /my", { - error, - message: error instanceof Error ? error.message : undefined, - stack: error instanceof Error ? error.stack : undefined, - cause: error instanceof Error ? error.cause : undefined, - }); - throw error; - } - // Kept outside the try so Next's redirect control-flow isn't caught/logged. + const { userId } = await auth(); if (!userId) { redirect("/auth/sign-in?redirect_url=/my"); } } - // TEMP DIAGNOSTIC: distinguish a data/render throw from an auth throw. - let hackathons: ReturnType; - try { - hackathons = loadHackathons(); - } catch (error) { - console.error("DATA FAILURE ON /my (loadHackathons)", { - error, - message: error instanceof Error ? error.message : undefined, - stack: error instanceof Error ? error.stack : undefined, - cause: error instanceof Error ? error.cause : undefined, - }); - throw error; - } - + const hackathons = loadHackathons(); return ( );