Open Closed

Identity related tables are not being generated in tenant database #8040


User avatar
0
JimmyLiew created
  • ABP Framework version: v8.3.0
  • UI Type: Angular
  • Database System: EF Core (SQL Server)
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes
  • Exception message and full stack trace:
  • Steps to reproduce the issue: Create a microservice startup template using ABP studio and create a new tenant with module specified connection string(please refer screenshot below). Click on Run > Build & Start All to run all the solutions using ABP studio.

Hi, I have encountered some problems when trying login to the tenant that created. I have consolidated some of the problems at below.

  • Notice that, some identity related tables are not being generated in tenant database.(E.g AbpUser table). I have tried manually apply the migration by clicking "Apply database migrations" button on the UI, but the missing tables still not being generated.

  • Notice that, login with this tenant option is missing in the Host UI.

  • Encountered "Invalid object name "AbpLanguageTexts" error when login to new created tenant . I have checked the **AbpLanguageTexts **table is existed in tenant administrator database.

Your advice would be greatly appreciated. Thank You.


37 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Notice that, some identity related tables are not being generated in tenant database.(E.g AbpUser table). I have tried manually apply the migration by clicking "Apply database migrations" button on the UI, but the missing tables still not being generated.

    Please check the logs.txt files. There may be errors.

  • User Avatar
    0
    JimmyLiew created

    Hi,

    I found there is no errors inside the log files. Based on the saas log file, it seems executed the tenant migration without any errors. However, the tenant database not reflected. I have tried to clear up redis cache as well. Do you mind share me your email, so that I can share you my solution?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Please share all logs.txt(all microserves) to liming.ma@volosoft.com

    Thanks.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    The migration error logs:

    [ERR] A connection was successfully established with the server, but then an error occurred during the login process.
    
     (provider: SSL Provider, error: 0 - The certificate chain was issued by an authority that is not trusted.)
    
    Microsoft.Data.SqlClient.SqlException (0x80131904): A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider, error: 0 - The certificate chain was issued by an authority that is not trusted.)
    
    System.ComponentModel.Win32Exception (0x80090325): The certificate chain was issued by an authority that is not trusted.
    
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Do you have TrustServerCertificate=True in your connection string?

  • User Avatar
    0
    JimmyLiew created

    Hi,

    Yes, I already added TrustServerCertificate=True in my tenant connection string previously.

    ,

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    What happens if you click the Test button?

  • User Avatar
    0
    JimmyLiew created

    Hi, It shows invalid connection string. However, the connection strings for Administration and AuditLog both are also showing invalid connection strings(same with tenant, just the database name different) but somehow both were able to generate the database schema.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    1. Try to change to TrustServerCertificate=True
    2. Try to use Encrypt=False

    https://learn.microsoft.com/en-us/ef/core/what-is-new/ef-core-7.0/breaking-changes?tabs=v7#mitigations

  • User Avatar
    0
    JimmyLiew created

    Hi, I have added Encrypt=False inside tenant connection string and manually apply migration. It seems like does not reflect to tenant database.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    You need Test your connection string first.

    xxxx.;Database=Tenant-A; TrustServerCertificate=True

    OR

    xxxx.;Database=Tenant-A; Encrypt=False

  • User Avatar
    0
    JimmyLiew created

    Hi,

    Both ways were showing invalid connection string.

    Server=localhost,1434; User Id=sa; Password=myPassw@rd; Database=Tenant-A;TrustServerCertificate=true Server=localhost,1434; User Id=sa; Password=myPassw@rd; Database=Tenant-A;Encrypt=False

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    ok, I will do some checks and reply to you soon.

    Thanks

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Maybe your database has a problem. I have tested it, and it works.

  • User Avatar
    0
    JimmyLiew created

    Hi,

    I have checked and confirmed the connection string below is accessible by SQL SSMS.

    Server=localhost,1434; User Id=sa; Password=myPassw@rd; Database=Tenant-A; TrustServerCertificate=true

    I have tried to call the check connection API by passing above connection string as input parameter, but unfortunately is was returning False. Seem like could not find any hints from saas log file.

    Would you advise is there any configuration that I have possible missed out? Do you mind to remote my PC to check?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Can you use this class to test your connection strings?

    https://github.com/abpframework/abp/blob/dev/framework/src/Volo.Abp.EntityFrameworkCore.SqlServer/Volo/Abp/EntityFrameworkCore/ConnectionStrings/SqlServerConnectionStringChecker.cs#L10

    Test button also use it to check the connection string.

  • User Avatar
    0
    JimmyLiew created

    Hi, I have tried both connection strings below. Both were returned result as false.

    Server=localhost,1434; User Id=sa; Password=myPassw@rd; Database=Tenant-A; TrustServerCertificate=true

    Server=localhost,1434; User Id=sa; Password=myPassw@rd; Database=Tenant-A;Encrypt=False

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Can you try connecting with a different SQL server database?

    Maybe the DB has a problem.

    Thanks

  • User Avatar
    0
    JimmyLiew created

    Hi, I have manually created a TestDB. Seem like still returned false.

    Server=localhost,1434; User Id=sa; Password=myPassw@rd; Database=TestDB; TrustServerCertificate=true Server=localhost,1434; User Id=sa; Password=myPassw@rd; Database=TestDB;Encrypt=False

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Can you create a new SQL server container and test it?

    https://learn.microsoft.com/en-us/sql/linux/quickstart-install-connect-docker?view=sql-server-ver16&tabs=cli&pivots=cs1-bash#run-the-container-2

  • User Avatar
    0
    JimmyLiew created

    Hi, I have pulled the latest sql-server 2022 and run in container(Docker Desktop).Still having the same problem.

    Docker command docker run -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=myPassw@rd" -p 1434:1433 --name sql1 --hostname sql1 -d mcr.microsoft.com/mssql/server:2022-latest

    Connection Strings Server=localhost,1434; User Id=sa; Password=myPassw@rd; Database=TestDB; TrustServerCertificate=true Server=localhost,1434; User Id=sa; Password=myPassw@rd; Database=TestDB;Encrypt=False

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Can you join the zoom and share your screen?

    https://us05web.zoom.us/j/83082142414?pwd=qbXdOEBKIFxbgxaPgpXnF4uNN2Jx4Y.1

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    I will find a solution soon.

    Thanks.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    I have confirmed: Currently ms doesn't support the one(default) database for microservice projects, You need to specify different connection strings for all modules.

    Add AbpIdentity and AbpOpenIddict in services\saas\MyTest.SaasService\MyTestSaasServiceModule.cs

    options.Databases.Configure("Identity", database =>
    {
        database.MappedConnections.Add("AbpIdentity");
        database.MappedConnections.Add("AbpOpenIddict");
    });
    

  • User Avatar
    0
    JimmyLiew created

    Hi, I have manually applied the code that you mentioned to services\saas\AbpMultiTenant.SaasService\AbpMultiTenantSaasServiceModule

    It provides the option to set connection string for Identity module.

    However, still encountered invalid connection string issue when click on Test connection string. And also encountered Invalid object name AbpLanguageTexts error when trying login with the new tenant i have created. I have checked AbpLanguageTexts table is existed in my tenant administrator database. Would like to get advise from you.

Made with ❤️ on ABP v9.1.0-preview. Updated on November 11, 2024, 11:11