Bugfix: EventBusService rejects MODULE_REGISTERED events with 'Tenan...
Documentation for Sessions
π Bugfix: EventBusService rejects MODULE_REGISTERED events with 'Tenan...
Date: 2026-03-09
Time: 13:39:37 UTC
Session: gspace1-191.2
Agent: angular
Confidence: 95%
Status: β
Documented
π Decision Context
Question:
EventBusService rejects MODULE_REGISTERED events with 'Tenant ID es requerido cuando tenant isolation estΓ‘ habilitado'. How should we fix module registration event publishing?
Task: Not specified
π― Decision Made
Chosen:
Use event.withMetadata({ tenantId }) after creating ModuleRegisteredEvent in ModuleRegistryService. tenantId comes from contextService.currentContext()?.tenantId ?? ''.
Options Considered:
- Disable enableTenantIsolation in gograb-space app config
- Modify ModuleRegisteredEvent constructor to accept metadata
- Use withMetadata() to add tenantId to event metadata before publish
π Reasoning
Root cause: EventBusService.publish() validates event.metadata.tenantId when enableTenantIsolation is true (default). ModuleRegistryService was putting tenantId in payload data, but EventBus checks metadata.tenantId. The fix: call event.withMetadata({ tenantId }) before publishing so metadata.tenantId is set. Empty string is allowed for pre-tenant-selection flows (per EventBus comment). Same pattern as TENANT_ISOLATION_FIX.md for WidgetEvent.
π Files Involved
libs/core/module-base/src/lib/services/module-registry.service.ts
π Related
- Decision ID:
dev_1773063577224_caqgbr9 - Session: 191
- Workspace: gspace1
Auto-generated by MCP Smart Consolidation