From 003105531584722fad675d544e09f5ff22872240 Mon Sep 17 00:00:00 2001 From: Michael Freno Date: Thu, 27 Aug 2026 08:55:51 -0400 Subject: [PATCH] nook: fix idempotent reactivation SQL bind (row object -> id) --- src/routes/api/the-nook/activate.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/routes/api/the-nook/activate.ts b/src/routes/api/the-nook/activate.ts index a108494..88e9ac8 100644 --- a/src/routes/api/the-nook/activate.ts +++ b/src/routes/api/the-nook/activate.ts @@ -57,9 +57,10 @@ export async function POST(event: APIEvent) { args: [license.id, fingerprint] }); if (existingRes.rows.length > 0) { + const existing = existingRes.rows[0] as { id: string }; // row we inserted as an activation await conn.execute({ sql: "UPDATE activations SET activated_at = ? WHERE id = ?", - args: [new Date().toISOString(), existingRes.rows[0] as { id: string }] + args: [new Date().toISOString(), existing.id] }); const count = await activeCount(conn, license.id); return json({ ok: true, email: license.email, activatedCount: count });