Sonarly Claude Code 36934df3bc fix: handle missing morph relation field in timeline activity for custom objects
https://sonarly.com/issue/15168?type=bug

The timeline activity worker crashes when processing events for custom objects whose morph relation field is missing from the timelineActivity object metadata, causing timeline activity recording to fail silently for affected workspaces.

Fix: **Fix:** Added a metadata validation check in `TimelineActivityRepository.upsertTimelineActivities()` that verifies the morph relation field exists in the `timelineActivity` object metadata before constructing queries with it.

**What changed:**

1. **`timeline-activity.repository.ts`**: Added `hasTimelineActivityMorphRelationField()` method that loads the workspace's flat entity maps, finds the `timelineActivity` object metadata, and checks whether the expected join column name exists in the field maps. If the field is missing, `upsertTimelineActivities()` logs a warning and returns early instead of letting `formatData` crash.

2. **`object-metadata-repository.module.ts`**: Updated the factory to inject `WorkspaceManyOrAllFlatEntityMapsCacheService` into repositories created through this module, so `TimelineActivityRepository` can access workspace metadata for validation.

**Why this approach:**
- Fixes the crash at the right layer (timeline repository) rather than suppressing errors in the shared `formatData` utility
- Preserves the strict validation in `formatData` (which catches other metadata inconsistencies)
- Logs a clear warning with actionable guidance (run workspace:sync-metadata)
- Matches the team's pattern of using `WorkspaceManyOrAllFlatEntityMapsCacheService` for metadata lookups (already used in `TimelineActivityService`)
2026-03-16 12:51:23 +00:00
2025-08-07 17:02:12 +02:00
2025-07-08 15:13:02 +02:00
2026-03-11 16:30:28 +01:00

Twenty logo

The #1 Open-Source CRM

🌐 Website · 📚 Documentation · Roadmap · Discord · Figma


Cover


Installation

See: 🚀 Self-hosting 🖥️ Local Setup

Why Twenty

We built Twenty for three reasons:

CRMs are too expensive, and users are trapped. Companies use locked-in customer data to hike prices. It shouldn't be that way.

A fresh start is required to build a better experience. We can learn from past mistakes and craft a cohesive experience inspired by new UX patterns from tools like Notion, Airtable or Linear.

We believe in open-source and community. Hundreds of developers are already building Twenty together. Once we have plugin capabilities, a whole ecosystem will grow around it.


What You Can Do With Twenty

Please feel free to flag any specific needs you have by creating an issue.

Below are a few features we have implemented to date:

Personalize layouts with filters, sort, group by, kanban and table views

Companies Kanban Views

Customize your objects and fields

Setting Custom Objects

Create and manage permissions with custom roles

Permissions

Automate workflow with triggers and actions

Workflows

Emails, calendar events, files, and more

Other Features


Stack

Thanks

Chromatic Greptile Sentry Crowdin E2B

Thanks to these amazing services that we use and recommend for UI testing (Chromatic), code review (Greptile), catching bugs (Sentry) and translating (Crowdin).

Join the Community

Languages
TypeScript 78%
MDX 18.5%
JavaScript 3.1%
Python 0.2%