Files
twenty/packages
sonarly-bot 8c347acb11 fix(auth): guard cache build when workspaceMember metadata is absent
https://sonarly.com/issue/41091?type=bug

A workspace-scoped request failed because the ORM metadata set for that workspace did not contain the required

Fix: Implemented a defensive fallback in `WorkspaceFlatWorkspaceMemberMapCacheService.computeForCache()` for the exact production failure mode:

- Wrapped the cache recomputation in a targeted `try/catch`.
- If the thrown error is `EntityMetadataNotFoundError`, the service now logs a warning and returns an empty `FlatWorkspaceMemberMaps` payload (`{ byId: {}, idByUserId: {} }`) instead of crashing the authenticated request path.
- Non-metadata errors are still rethrown unchanged.

This prevents user-facing 500s when a workspace runtime metadata set is missing `workspaceMember`, while keeping the behavior strict for unrelated failures.

Added tests:
- Returns empty maps when `EntityMetadataNotFoundError` occurs.
- Rethrows other unexpected errors.

Authored by Sonarly by autonomous analysis (run 46844).
2026-05-27 14:20:01 +00:00
..
2026-05-27 14:33:57 +02:00