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) {