You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(tier-client): avoid 414 URI Too Large on orgs with many enrollments (#1390)
## Summary
- **Root cause**: After migrating from DynamoDB to PostgREST,
`batchGetByKeys` generates GET requests with `?id=in.(uuid1,uuid2,...)`
in the URL. For orgs with hundreds of site enrollments, this exceeds
HTTP URL length limits causing **414 Request-URI Too Large**.
- **`getAllEnrollment()`**: When a specific site is provided, skips
batch fetch entirely and uses a single `findById` call. For org-only
path, chunks `batchGetByKeys` into groups of 50 IDs (~1,800 chars per
chunk, well under 8KB limit).
- **`getFirstEnrollment()`**: Now standalone (no longer calls
`getAllEnrollment`). Site-specific path does in-memory match and returns
`this.site` directly. Org-only path iterates enrollments with `findById`
one at a time with early exit on first match.
## Test plan
- [x] All 70 unit tests pass
- [x] 100% code coverage (statements, branches, functions, lines)
- [x] ESLint clean
- [ ] Deploy to dev and test `sites-resolve` endpoint with AEM Reference
Demo org (the org that was hitting 414)
- [ ] Verify login flow works for orgs with many enrollments
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
0 commit comments