Resolve the domain on /org/current server-side

FixSecurityService
Shipped
August 24, 2026 at 10:20 PM UTC
Author
Kamo
Commit
102a4f2

internal.kamocrm.com failed to render with "Invalid organization data: missing 'id' or 'domain'". Organization has no `domain` field -- it has a `domains` collection -- and the client's Organization.fromJSON throws without one, before the shell renders. The by-host lookup gets away with it because its caller injects the host it asked about; /org/current has no such host. Resolved here rather than derived on the client, because the client cannot do it correctly. `domains` is a LAZY collection and Hibernate6Module serializes an uninitialized one as null, so a client falling back to {alias}.kamocrm.com would name the platform organization "crm.kamocrm.com" and look for its branding in a folder that does not exist -- a quieter failure than the one being fixed. resolvePrimaryDomain already answers this exactly as the theme provisioner does: a DNS-verified active domain, then any active one, then {alias}.kamocrm.com. Returning a Map keeps every field the projection already produced and adds the one the client needs; ids still leave as strings, since the wire mapper's rule is by value range and applies inside a Map too. 938 tests pass.

All changes

Like what you see shipping?

Every one of these updates lands in your workspace automatically. Start free and watch it grow week after week.

Start Free ForeverView Pricing