Open Closed

Error in DBMigrator with multitenant App #8245


User avatar
0
costaconsulting created

I have a multitenant abp.io application, where there are 4 tenants in the database, which is running in production, but I made some changes, I updated the version to 8.3.2 after generating a new migration, when I try to run DBMigrator, always gives me the following error and does not run the await SeedDataAsync(tenant);

ABP Framework version: v8.3.2

  • UI Type: MVC
  • Database System: EF Core (SQL Server)
  • **Tiered (for MVC) yes
  • Exception message and full stack trace:

[06:26:11 INF] Executing XXXX tenant database seed... [06:26:11 INF] Both id and name can't be invalid. [06:26:11 ERR] Error migrating database for tenant XXXX (Id: 4a284082-a263-8112-5c72-3a0e31a6d10f). Volo.Abp.AbpException: Both id and name can't be invalid. at Volo.Abp.MultiTenancy.TenantConfigurationCacheItem.CalculateCacheKey(Nullable`1 id, String name) at Volo.Abp.TenantManagement.TenantConfigurationCacheItemInvalidator.ClearCacheAsync(Nullable`1 id, String normalizedName) at Volo.Abp.TenantManagement.TenantConfigurationCacheItemInvalidator.HandleEventAsync(EntityChangedEventData`1 eventData) at Volo.Abp.EventBus.EventHandlerInvoker.InvokeAsync(IEventHandler eventHandler, Object eventData, Type eventType) at Volo.Abp.EventBus.Local.LocalEventBus.InvokeEventHandlerAsync(IEventHandler eventHandler, Object eventData, Type eventType) at Volo.Abp.EventBus.EventBusBase.TriggerHandlerAsync(IEventHandlerFactory asyncHandlerFactory, Type eventType, Object eventData, List`1 exceptions, InboxConfig inboxConfig) at System.AbpExceptionExtensions.ReThrow(Exception exception) at Volo.Abp.EventBus.EventBusBase.ThrowOriginalExceptions(Type eventType, List`1 exceptions) at Volo.Abp.EventBus.EventBusBase.TriggerHandlersAsync(Type eventType, Object eventData) at Volo.Abp.EventBus.Local.LocalEventBus.PublishAsync(LocalEventMessage localEventMessage) at Volo.Abp.EventBus.Local.LocalEventBus.PublishToEventBusAsync(Type eventType, Object eventData) at Volo.Abp.EventBus.Local.LocalEventBus.PublishAsync(Type eventType, Object eventData, Boolean onUnitOfWorkComplete) at Volo.Abp.EventBus.UnitOfWorkEventPublisher.PublishLocalEventsAsync(IEnumerable`1 localEvents) at Volo.Abp.Uow.UnitOfWork.CompleteAsync(CancellationToken cancellationToken) at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed) at XXXXXXXX.Data.ComplianceDbMigrationService.SeedDataAsync(Tenant tenant) in C:\dev\Compliance\src\CostaConsulting.Compliance.Domain\Data\ComplianceDbMigrationService.cs:line 161 at CostaConsulting.Compliance.Data.ComplianceDbMigrationService.MigrateAsync() in C:\dev\Compliance\src\CostaConsulting.Compliance.Domain\Data\ComplianceDbMigrationService.cs:line 127

  • Steps to reproduce the issue:

Get a database with 3 o 4 tenant, make some changes at the domain adding some few new field, add new migration run DBMigrator.

get [06:26:11 INF] Both id and name can't be invalid.


1 Answer(s)
  • User Avatar
    0
    costaconsulting created

    The problem was that the [NormalizedName] field of the tenant was empty.

Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v9.3.0-preview. Updated on May 15, 2025, 10:28