Open Closed

Separate Database For Multitenancy Architecture not working #8250


User avatar
0
nayan.ranjane@softtech-engr.com created

I have abp default template of verison 8.2 which is having Saas pro module inbuilt and creation of tenant is working fine but if i change my approach to separate database then its allowing me to create tenant but then user not found error is there given me steps to solve current documentation doesn't provide brief idea

  • ABP Framework version: 8.2
  • UI Type: MVC
  • Database System: EF Core (SQL Server, Oracle, MySQL, PostgreSQL, etc..)

9 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    could you share some screenshots and error log

  • User Avatar
    0
    nayan.ranjane@softtech-engr.com created

    There is no such error log over there but I've shared you my templateProject on your mail so please check why after giving seperate connection string in tenant creation why user not found error is there and also no migration is created in given database after adding connection string.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    I have no permission to access file.

  • User Avatar
    0
    nayan.ranjane@softtech-engr.com created

    Shared you another link

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    I can't reproduce the problem.

  • User Avatar
    0
    nayan.ranjane@softtech-engr.com created

    does the database created by migration itself or need to create empty database. And if yes then how to run migration script. Now please give me your steps to use this

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    does the database created by migration itself

    Yes, you don't need to do anything, it will automatically create the database and do the data migration

    Now please give me your steps to use this

    • Open create tenant modal
    • Client the database connection string tab and input the database connection string
    • Click the save button
  • User Avatar
    0
    nayan.ranjane@softtech-engr.com created

    No database is created by given steps sharing you logs [12:37:03 INF] Request starting HTTP/2 POST https://localhost:44300/Saas/Host/Tenants/CreateModal - application/x-www-form-urlencoded; charset=UTF-8 598 [12:37:03 INF] No CORS policy found for the specified request. [12:37:03 DBG] Get dynamic claims cache for user: 654dd381-8404-b2e1-3b2d-3a1578068640 [12:37:03 DBG] SessionId(b2df20e9-e052-4d73-944d-b69ee8854a46) found in cache, Updating hit count(0), last access time(11/11/2024 12:35:53 PM) and IP address(::1). [12:37:03 DBG] Updating the session from cache on the first check. [12:37:03 DBG] PermissionStore.GetCacheItemAsync: pn:U,pk:654dd381-8404-b2e1-3b2d-3a1578068640,n:Saas.Tenants.Create [12:37:03 DBG] Found in the cache: pn:U,pk:654dd381-8404-b2e1-3b2d-3a1578068640,n:Saas.Tenants.Create [12:37:03 DBG] PermissionStore.GetCacheItemAsync: pn:R,pk:admin,n:Saas.Tenants.Create [12:37:03 DBG] Found in the cache: pn:R,pk:admin,n:Saas.Tenants.Create [12:37:03 INF] Executing endpoint '/Saas/Host/Tenants/CreateModal' [12:37:03 INF] Route matched with {page = "/Saas/Host/Tenants/CreateModal", area = "", action = "", controller = ""}. Executing page /Saas/Host/Tenants/CreateModal [12:37:03 INF] Skipping the execution of current filter as its not the most effective filter implementing the policy Microsoft.AspNetCore.Mvc.ViewFeatures.IAntiforgeryPolicy [12:37:03 INF] Executing handler method Volo.Saas.Host.Pages.Saas.Host.Tenants.CreateModalModel.OnPostAsync - ModelState is Valid [12:37:03 DBG] PermissionStore.GetCacheItemAsync: pn:U,pk:654dd381-8404-b2e1-3b2d-3a1578068640,n:Saas.Tenants.Create [12:37:03 DBG] Found in the cache: pn:U,pk:654dd381-8404-b2e1-3b2d-3a1578068640,n:Saas.Tenants.Create [12:37:03 DBG] PermissionStore.GetCacheItemAsync: pn:R,pk:admin,n:Saas.Tenants.Create [12:37:03 DBG] Found in the cache: pn:R,pk:admin,n:Saas.Tenants.Create [12:37:03 DBG] PermissionStore.GetCacheItemAsync: pn:U,pk:654dd381-8404-b2e1-3b2d-3a1578068640,n:Saas.Tenants [12:37:03 DBG] Found in the cache: pn:U,pk:654dd381-8404-b2e1-3b2d-3a1578068640,n:Saas.Tenants [12:37:03 DBG] PermissionStore.GetCacheItemAsync: pn:R,pk:admin,n:Saas.Tenants [12:37:03 DBG] Found in the cache: pn:R,pk:admin,n:Saas.Tenants [12:37:03 DBG] Added 0 entity changes to the current audit log [12:37:03 DBG] Added 0 entity changes to the current audit log [12:37:03 DBG] Added 0 entity changes to the current audit log [12:37:03 INF] Executed handler method OnPostAsync, returned result Microsoft.AspNetCore.Mvc.NoContentResult. [12:37:03 INF] Executing StatusCodeResult, setting HTTP status code 204 [12:37:03 INF] Executed page /Saas/Host/Tenants/CreateModal in 123.9588ms [12:37:03 INF] Executed endpoint '/Saas/Host/Tenants/CreateModal' [12:37:03 DBG] Added 0 entity changes to the current audit log [12:37:03 DBG] Added 0 entity changes to the current audit log [12:37:03 DBG] Added 0 entity changes to the current audit log [12:37:03 DBG] Executing HealthCheck collector HostedService. [12:37:03 INF] Start processing HTTP request GET https://localhost:44300/health-status [12:37:03 INF] Sending HTTP request GET https://localhost:44300/health-status [12:37:03 INF] Request starting HTTP/1.1 GET https://localhost:44300/health-status - null null [12:37:03 INF] Executing endpoint 'Health checks' [12:37:03 DBG] Added 0 entity changes to the current audit log [12:37:03 INF] Executed endpoint 'Health checks'

    also following service returning me null [12:43:11 INF] Request finished HTTP/2 POST https://localhost:44300/api/saas/tenants/bb4107d8-db42-908a-8024-3a162c38fc48/apply-database-migrations - 204 null null 113.7705ms

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    CivitCoreIdentityTenantDatabaseMigrationHandler is used for database migration.

    See https://drive.google.com/file/d/1a9fFvczG6PrXM6fNeB8gashVbUZ7jIIh/view?usp=sharing

Made with ❤️ on ABP v9.1.0-preview. Updated on December 12, 2024, 07:15