KamoCRM

Give /api/org/current the domain the client requires

Fixkamo-internal
Shipped
24 ஆகஸ்ட், 2026 அன்று 10:15 PM UTC
Author
kamo
Commit
521d917

internal.kamocrm.com failed to render with "Invalid organization data: missing 'id' or 'domain'". Organization.fromJSON refuses a record without a domain, and the Organization entity does not carry one -- it has a `domains` collection. The by-host route injects the host it was asked about (route.ts:577); /api/org/current had no host to inject and returned the upstream JSON verbatim, so `domain` was undefined and the shell threw before it rendered. The domain is now derived: the org's own active top-level row when it has one, otherwise {alias}.kamocrm.com -- the same fallback SecurityService uses to name the org's theme folder, so branding resolves to the same place from both sides. Alias rows are skipped; they hold a bare label, not a hostname. When nothing can be derived the route 404s rather than return a record the client will throw on, and the layout falls back to the host lookup as it already does for a signed-out visitor. 2873 tests pass.

All changes

Like what you see shipping?

All of it arrives in your workspace on its own. Start on the free plan and read this page again in a month.

Start Free ForeverView Pricing