fix(04-07): remove debug code — public page restored
Root cause: INTERNAL_SECRET was on same line as HOST= in .env (no trailing newline when appended), so proxy middleware got empty secret and rejected all /api/internal/validate-* calls → rewrote every /client/* request to /not-found without running the page component.
This commit is contained in:
@@ -90,8 +90,6 @@ export default async function ClientPage({
|
|||||||
params: Promise<{ token: string }>;
|
params: Promise<{ token: string }>;
|
||||||
}) {
|
}) {
|
||||||
const { token } = await params;
|
const { token } = await params;
|
||||||
const { appendFileSync } = await import("fs");
|
|
||||||
appendFileSync("/tmp/clienthub-debug.log", `[${new Date().toISOString()}] PAGE token=${token}\n`);
|
|
||||||
|
|
||||||
const clientData = await getCachedClientData(token);
|
const clientData = await getCachedClientData(token);
|
||||||
if (!clientData) notFound();
|
if (!clientData) notFound();
|
||||||
|
|||||||
@@ -133,9 +133,6 @@ export interface ClientProjectSummary {
|
|||||||
export async function getClientWithProjectsByToken(
|
export async function getClientWithProjectsByToken(
|
||||||
tokenOrSlug: string
|
tokenOrSlug: string
|
||||||
): Promise<ClientProjectSummary | null> {
|
): Promise<ClientProjectSummary | null> {
|
||||||
const fs = await import("fs");
|
|
||||||
const logLine = `[${new Date().toISOString()}] lookup: ${tokenOrSlug}\n`;
|
|
||||||
fs.appendFileSync("/tmp/clienthub-debug.log", logLine);
|
|
||||||
try {
|
try {
|
||||||
// Try slug first
|
// Try slug first
|
||||||
let clientRows = await db
|
let clientRows = await db
|
||||||
@@ -178,8 +175,7 @@ export async function getClientWithProjectsByToken(
|
|||||||
|
|
||||||
return { client, projects: activeProjects };
|
return { client, projects: activeProjects };
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
const fs = await import("fs");
|
console.error("[client-view] getClientWithProjectsByToken error:", err);
|
||||||
fs.appendFileSync("/tmp/clienthub-debug.log", `[${new Date().toISOString()}] ERROR: ${String(err)}\nStack: ${(err as Error)?.stack ?? "no stack"}\n`);
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user