From e3c71704481b8eecedaaf1697671632079cd2273 Mon Sep 17 00:00:00 2001 From: tikibozo <4793440+tikibozo@users.noreply.github.com> Date: Thu, 21 May 2026 00:37:39 -0700 Subject: [PATCH] fix(api): raise bodyParser limit on albums-by-assets The /api/assets/albums-by-assets route accepts a POST body shaped { assetIds: string[] } and is invoked from the bulk-duplicate-finder page with every asset across every duplicate group. With a large duplicate set the body easily exceeds Next.js's default 1 MB bodyParser limit and the route returns 413 before the handler runs. Concrete case: a library with ~14,500 duplicate groups produces a request body around 1.4-1.8 MB, which is rejected. The page renders but never finishes loading (413 in browser console). Fix: add the per-route Next.js bodyParser config to bump the limit to 10 MB, leaving plenty of headroom for very large libraries while still bounding worst-case request size. --- src/pages/api/assets/albums-by-assets.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/pages/api/assets/albums-by-assets.ts b/src/pages/api/assets/albums-by-assets.ts index 3573a9a..cf29784 100644 --- a/src/pages/api/assets/albums-by-assets.ts +++ b/src/pages/api/assets/albums-by-assets.ts @@ -5,6 +5,14 @@ import { albums } from "@/schema/albums.schema"; import { albumsAssetsAssets } from "@/schema/albumAssetsAssets.schema"; import { eq, inArray, and } from "drizzle-orm"; +export const config = { + api: { + bodyParser: { + sizeLimit: "10mb", + }, + }, +}; + export default async function handler( req: NextApiRequest, res: NextApiResponse