From 9f7ab870bac36188a7801575b9f365842bda49e7 Mon Sep 17 00:00:00 2001 From: Mannu Date: Sun, 24 May 2026 01:55:48 +0530 Subject: [PATCH] fix: pass ISO string not Date object to sql.unsafe for expires_at MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit postgres.js sql.unsafe() doesn't serialize Date objects in parameterized queries — caused TypeError crashing the invite creation endpoint. Co-Authored-By: Claude Sonnet 4.6 --- src/app/api/circles/[id]/invite/route.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/api/circles/[id]/invite/route.ts b/src/app/api/circles/[id]/invite/route.ts index c942c3d..27359a7 100644 --- a/src/app/api/circles/[id]/invite/route.ts +++ b/src/app/api/circles/[id]/invite/route.ts @@ -26,7 +26,7 @@ export async function POST( // Cryptographically random 32-byte token (64 hex chars) — unguessable const token = randomBytes(32).toString("hex"); - const expiresAt = new Date(Date.now() + 7 * 24 * 60 * 60 * 1000); // 7 days + const expiresAt = new Date(Date.now() + 7 * 24 * 60 * 60 * 1000).toISOString(); // 7 days const [invite] = await sql.unsafe( `INSERT INTO circle_invites (circle_id, token, created_by, expires_at)