fix(table): return 400 instead of 500 on empty batch insert (#4329)

The POST /api/table/[tableId]/rows handler called handleBatchInsert
without await, so ZodError rejections (e.g. empty rows array) bypassed
the route's try/catch and were caught by withRouteHandler as an
unhandled error, returning a generic 500 "Internal server error". Add
await so validation errors surface as 400s with the actual message.
This commit is contained in:
Waleed
2026-04-28 17:26:14 -07:00
committed by GitHub
parent 9ac73bb4b8
commit 3784f5465a
@@ -232,7 +232,7 @@ export const POST = withRouteHandler(
'rows' in body &&
Array.isArray((body as Record<string, unknown>).rows)
) {
return handleBatchInsert(
return await handleBatchInsert(
requestId,
tableId,
body as z.infer<typeof BatchInsertRowsSchema>,