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.
This commit is contained in:
tikibozo committed 2026-05-21 00:37:39 -07:00
1 parent 54038c2512
commit e3c7170448
1 file changed
+8
+8
View File
@@ -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