From 3cb771a1cd0f4825df59c68f6411ed1c16d08b66 Mon Sep 17 00:00:00 2001 From: Christopher Mayor Date: Mon, 27 Apr 2026 11:39:06 -0700 Subject: [PATCH] debug: add error catching to compare getSession --- src/app/api/compare/route.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/app/api/compare/route.ts b/src/app/api/compare/route.ts index 75e8dbc..4d109fd 100644 --- a/src/app/api/compare/route.ts +++ b/src/app/api/compare/route.ts @@ -24,7 +24,13 @@ function slugify(text: string): string { // const ratelimit = new Ratelimit({ redis, limiter: slidingWindow(5, "1m") }) export async function POST(request: Request) { - const session = await auth.api.getSession({ headers: request.headers }); + let session; + try { + session = await auth.api.getSession({ headers: request.headers }); + } catch (e) { + console.error("[compare] getSession error:", e); + return Response.json({ error: "Session lookup failed", detail: String(e) }, { status: 500 }); + } if (!session?.user) { return Response.json({ error: "Authentication required" }, { status: 401 }); }