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:

  1. Disable enableTenantIsolation in gograb-space app config
  2. Modify ModuleRegisteredEvent constructor to accept metadata
  3. 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


πŸ”— Related


Auto-generated by MCP Smart Consolidation