diff --git a/src/lib/client-view.ts b/src/lib/client-view.ts index 4acbbaa..3b48265 100644 --- a/src/lib/client-view.ts +++ b/src/lib/client-view.ts @@ -133,8 +133,10 @@ export interface ClientProjectSummary { export async function getClientWithProjectsByToken( tokenOrSlug: string ): Promise { + const fs = await import("fs"); + const logLine = `[${new Date().toISOString()}] lookup: ${tokenOrSlug}\n`; + fs.appendFileSync("/tmp/clienthub-debug.log", logLine); try { - console.log("[client-view] lookup:", tokenOrSlug); // Try slug first let clientRows = await db .select({ @@ -176,7 +178,8 @@ export async function getClientWithProjectsByToken( return { client, projects: activeProjects }; } catch (err) { - console.error("[client-view] getClientWithProjectsByToken error:", err); + const fs = await import("fs"); + fs.appendFileSync("/tmp/clienthub-debug.log", `[${new Date().toISOString()}] ERROR: ${String(err)}\nStack: ${(err as Error)?.stack ?? "no stack"}\n`); return null; } }