fix: handle missing file entity in avatar deletion listener#20192
Conversation
📊 API Changes ReportGraphQL Schema ChangesGraphQL Schema Changes[error] Error: Unable to read JSON file: /home/runner/work/twenty/twenty/main-schema-introspection.json: Not valid JSON content GraphQL Metadata Schema ChangesGraphQL Metadata Schema Changes[error] Error: Unable to read JSON file: /home/runner/work/twenty/twenty/main-metadata-schema-introspection.json: Not valid JSON content REST API Analysis ErrorError OutputREST Metadata API Analysis ErrorError Output |
Problem
When a
workspaceMemberis updated (e.g., theme/locale/avatar changes), theWorkspaceMemberAvatarFileDeletionListenertriggers file deletion. If the referenced file entity doesn't exist in the database, an unhandledEntityNotFoundErrorcrashes the NestJS server, causing a 502 loop.Change
Wrap the file deletion call in a try-catch that gracefully handles
EntityNotFoundErroras a no-op — if the file doesn't exist, there's nothing to delete.Fixes #20191.
Made with Cursor