datahub icon indicating copy to clipboard operation
datahub copied to clipboard

DataHub V2 UI crashes when CORP_GROUP entity appears first in search results

Open yorubaphenom opened this issue 6 months ago • 0 comments

The DataHub V2 UI search results page crashes with TypeError: Cannot read properties of undefined (reading 'relationships') when a CORP_GROUP entity appears as the first result on any search page. The crash is caused by incomplete GraphQL response data where CORP_GROUP entities have malformed memberCount objects missing the relationships field that the UI expects.

To Reproduce Steps to reproduce the behavior:

Log into DataHub V2 UI Type any search term in the search bar (e.g., "test") Navigate through search result pages using pagination When you reach a page where a CORP_GROUP entity appears as the first result (position 0), the page crashes immediately

Alternative reproduction:

Log into DataHub V2 UI Search for "test" Navigate to page 2 of results (or any page starting with a CORP_GROUP entity) See error in browser console and page becomes unresponsive

Expected behavior The search results page should load successfully and display all entities (both DATASET and CORP_GROUP types) without crashing, regardless of which entity type appears first in the results. Screenshots TypeError: Cannot read properties of undefined (reading 'relationships') at lG2 (index-790cfe93.js:23478:528) at fle (index-790cfe93.js:37:53681) at rRt (index-790cfe93.js:41:8861) at eRt (index-790cfe93.js:41:970) at vK1 (index-790cfe93.js:41:893) at GJ (index-790cfe93.js:41:741) at aOe (index-790cfe93.js:39:10974) at index-790cfe93.js:37:39377 at e.unstable_runWithPriority (index-790cfe93.js:26:3812) at _L (index-790cfe93.js:37:39143) Desktop (please complete the following information):

OS: [e.g. Windows 10, macOS, Linux] Browser: [e.g. Chrome, Firefox, Safari] Version: [e.g. Chrome 91]

Additional context Root Cause Analysis The issue is caused by inconsistent GraphQL response structures for EntityRelationshipsResult objects: ❌ Broken CORP_GROUP memberCount (missing relationships field): json{ "memberCount": { "total": 1, "__typename": "EntityRelationshipsResult" // Missing: "relationships": [] } } ✅ Working DATASET dataProduct (complete structure): json{ "dataProduct": { "relationships": [], "__typename": "EntityRelationshipsResult" } } Why Only Some Pages Crash The crash occurs based on entity positioning, not entity count. The V2 UI processes the first entity immediately on page load:

✅ Pages that work: First entity is DATASET → UI accesses dataProduct.relationships ✅ ❌ Pages that crash: First entity is CORP_GROUP → UI tries to access memberCount.relationships ❌

Investigation Evidence Analyzed multiple search result pages: Page 1 (items 0-9): ✅ Works

Position 0: DATASET entity Positions 1-9: CORP_GROUP entities (all with broken memberCount) Result: No crash because first entity is DATASET

Page 2 (items 10-19): ❌ Crashes

Position 0: CORP_GROUP entity with broken memberCount Positions 1-9: DATASET entities Result: Crashes because first entity is CORP_GROUP

Page 3 (items 20-29): ✅ Works

All entities are DATASET type Result: No crash because no CORP_GROUP entities

Proposed Solution Backend Fix (Recommended): Update the GraphQL resolver for CORP_GROUP memberCount to include the missing relationships field: json{ "total": 1, "relationships": [], // ← Add this field "__typename": "EntityRelationshipsResult" } Frontend Fix (Defensive): Add null checking in V2 UI: javascript// Instead of: entity.memberCount.relationships // Use: entity.memberCount?.relationships || [] Impact

Severity: High - Complete page crashes preventing users from viewing search results Scope: Affects any search results page where CORP_GROUP entities appear first User Experience: Users may think the system is broken when they hit these pages

This represents a GraphQL schema consistency issue where EntityRelationshipsResult objects don't maintain the same field structure across different entity types.

Image

yorubaphenom avatar Jun 10 '25 16:06 yorubaphenom