Skip to content

Commit 3784f54

Browse files
authored
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.
1 parent 9ac73bb commit 3784f54

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

  • apps/sim/app/api/table/[tableId]/rows

apps/sim/app/api/table/[tableId]/rows/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ export const POST = withRouteHandler(
232232
'rows' in body &&
233233
Array.isArray((body as Record<string, unknown>).rows)
234234
) {
235-
return handleBatchInsert(
235+
return await handleBatchInsert(
236236
requestId,
237237
tableId,
238238
body as z.infer<typeof BatchInsertRowsSchema>,

0 commit comments

Comments
 (0)