POST /v1/library/uuids takes up to 1,000 path → uuid pairs, but kept
body-parser's 100 KB. Production paths average 72 bytes, so a full
batch is about 114 KB and was refused with an uncoded 413. iOS and the
web cut batches by count only, and the missing-items pass sends every
unknown item through /uuids inline, so a first sync with about 900 or
more unknown items failed on every refresh and the library never got
registered. The route now parses its own body with the 5 MB limit,
after checkSubscription and requireCloudData, as /status does.
Problem
POST /v1/library/uuidsaccepts up to 1,000 path → uuid pairs, but it kept body-parser's default 100 KB limit. A 1% sample of production keys averages 72 bytes, so a full batch at the average path is about 114 KB. The API refuses it with a 413 that has no error code./uuidsbatches at 1,000 entries, whatever their size (SyncJobScheduler.matchUuidsBatchLimit, the web'sMATCH_BATCH)./uuidsinline, before registering them. So a first sync (after signing in, or after a lapse) with about 900 or more unknown items, where every file inside a folder counts, fails on every refresh, and that device's library never gets registered.MatchUuidsBatching).How many users this hit can't be counted. The API doesn't log 4xx responses, the load balancer has no access logs, and body-parser refuses the request before the router, so
sync_operationsnever sees it.Fix
/v1/library/uuidsnow parses its own body with the 5 MB limit, the same way/v1/library/statusdoes: the globaljsonBodyskips the path, and the route runslargeJsonBodyaftercheckSubscriptionandrequireCloudData, so an anonymous request still can't make the server read a large body. The 1,000-pair cap per request is unchanged. This fixes the shipped iOS builds and the web without an app update.recordSyncOperationreadsreq.bodywhen the response finishes, after the route has parsed it, so the audit rows formatch_uuidskeep their params.Testing
tsc --noEmitpasses.jsonBody.test.ts: 1,000 pairs at 72-byte paths, asserted to be over 100 KB, parse on/v1/library/uuids. All 5 body-limit tests pass./uuidstaken off the route list, the new test fails with a 413.🤖 Generated with Claude Code