From 2d402c04826387a7d09e451d02d9bd2d8a86836b Mon Sep 17 00:00:00 2001 From: Dave Date: Fri, 14 Aug 2026 21:06:21 +0200 Subject: [PATCH] fix: strip id/system fields before creating PB records --- lib/pb.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/pb.ts b/lib/pb.ts index 7d4aa24..a54e054 100644 --- a/lib/pb.ts +++ b/lib/pb.ts @@ -86,11 +86,13 @@ export async function createRecord( collection: string, fields: Record, ): Promise { + // Strip id/system fields — let PB auto-generate them. + const { id: _id, created: _c, updated: _u, ...safeFields } = fields; const url = `${BASE_URL}/api/collections/${collection}/records`; const res = await fetch(url, { method: "POST", headers: { Authorization: TOKEN as string, "Content-Type": "application/json" }, - body: JSON.stringify(fields), + body: JSON.stringify(safeFields), cache: "no-store", }); if (!res.ok) {