Open Closed

Tenant not found exception on login page #5829


User avatar
0
ibrahim.onat created
  • ABP Framework version: v7.3.3

  • UI Type: Angular

  • Database System: EF Core

  • Tiered (for MVC) or Auth Server Separated (for Angular): yes

  • Exception message and full stack trace: [17:51:41 INF] Request starting HTTP/2 GET https://localhost:44332/Account/Login?ReturnUrl=%2Fconnect%2Fauthorize%3Fresponse_type%3Dcode%26client_id%3DBookStore_App%26state%3DSk9DOElmRHNGWmhNazRCTk1SdXpnWkFNd0J5T2hWZXdMWGQtV0NWM1ZMZXh3%26redirect_uri%3Dhttp%253A%252F%252Flocalhost%253A4200%26scope%3Dopenid%2520offline_access%2520BookStore%26code_challenge%3D5O6CX6wTReFOCS5GoNh6LtrYhf72KjMcfv1QHjzApTw%26code_challenge_method%3DS256%26nonce%3DSk9DOElmRHNGWmhNazRCTk1SdXpnWkFNd0J5T2hWZXdMWGQtV0NWM1ZMZXh3%26culture%3Den%26ui-culture%3Den - - [17:51:41 DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessRequestContext was successfully processed by OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandlers+ResolveRequestUri. [17:51:41 DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by OpenIddict.Server.AspNetCore.OpenIddictServerAspNetCoreHandlers+ResolveRequestUri. [17:51:41 DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by OpenIddict.Server.OpenIddictServerHandlers+InferEndpointType. [17:51:41 DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by OpenIddict.Server.AspNetCore.OpenIddictServerAspNetCoreHandlers+ValidateTransportSecurityRequirement. [17:51:41 DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by OpenIddict.Server.AspNetCore.OpenIddictServerAspNetCoreHandlers+ValidateHostHeader. [17:51:41 DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was successfully processed by OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandlers+ValidateHostHeader. [17:51:41 DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was successfully processed by OpenIddict.Validation.OpenIddictValidationHandlers+EvaluateValidatedTokens.[17:51:41 DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was successfully processed by OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandlers+ExtractAccessTokenFromAuthorizationHeader. [17:51:41 DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was successfully processed by OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandlers+ExtractAccessTokenFromBodyForm. [17:51:41 DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was successfully processed by OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandlers+ExtractAccessTokenFromQueryString. [17:51:41 DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was successfully processed by OpenIddict.Validation.OpenIddictValidationHandlers+ValidateRequiredTokens. [17:51:41 DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessAuthenticationContext was marked as rejected by OpenIddict.Validation.OpenIddictValidationHandlers+ValidateRequiredTokens. [17:51:41 DBG] AuthenticationScheme: OpenIddict.Validation.AspNetCore was not authenticated. [17:51:41 WRN] Tenant not found! Volo.Abp.BusinessException: Tenant not found! at Volo.Abp.MultiTenancy.TenantConfigurationProvider.GetAsync(Boolean saveResolveResult) at Volo.Abp.AspNetCore.MultiTenancy.MultiTenancyMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) [17:51:41 WRN] Code:Volo.AbpIo.MultiTenancy:010001 [17:51:41 WRN] Details:There is no tenant with the tenant id or name: a4b425d2-1045-6438-3e12-3a0dc53f1a41 [17:51:41 INF] Request finished HTTP/2 GET https://localhost:44332/Account/Login?ReturnUrl=%2Fconnect%2Fauthorize%3Fresponse_type%3Dcode%26client_id%3DBookStore_App%26state%3DSk9DOElmRHNGWmhNazRCTk1SdXpnWkFNd0J5T2hWZXdMWGQtV0NWM1ZMZXh3%26redirect_uri%3Dhttp%253A%252F%252Flocalhost%253A4200%26scope%3Dopenid%2520offline_access%2520BookStore%26code_challenge%3D5O6CX6wTReFOCS5GoNh6LtrYhf72KjMcfv1QHjzApTw%26code_challenge_method%3DS256%26nonce%3DSk9DOElmRHNGWmhNazRCTk1SdXpnWkFNd0J5T2hWZXdMWGQtV0NWM1ZMZXh3%26culture%3Den%26ui-culture%3Den - - - 404 - text/html 30.0742ms [17:51:41 INF] Request starting HTTP/2 GET https://localhost:44332/favicon.ico - - [17:51:41 INF] Sending file. Request path: '/favicon.ico'. Physical path: 'N/A' [17:51:41 INF] Request finished HTTP/2 GET https://localhost:44332/favicon.ico - - - 200 38078 image/x-icon 2.4380ms

  • Steps to reproduce the issue:

  1. Log into an administrator account and create a tenant.
  2. Log out of the account, go to the login page and enter the newly created tenant. Do not proceed to login.
  3. Open another window (incognito was used to avoid cookies), login to the admin account.
  4. Under tenant management, delete the newly created tenant.
  5. Log out from the incognito window.
  6. Return to the main window and refresh the page. This will yield an exception with a "Tenant not found!" message and the "Failed to load resource: the server responded with a status of 404 ()" error log on the console. An image has been attached below.


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

    hi

    This is normal behavior. Refreshing the page will solve the problem. The web project cannot always check whether the tenant exists.

  • User Avatar
    0
    guven.uysall created

    Hi, You can delete browser history.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Refresh page will delete the tenant cookies as well.

  • User Avatar
    0
    ibrahim.onat created

    Hi,

    As a customer I would prefer to not see an error message stating that the tenant was not found, and would rather see the login screen with the tenant field returned to its initial state; that is without any tenant (i.e. displaying "Not selected"). Having to refresh and clearing cookies is detrimental to the UX, and preferably the login view should simply reset to a state that lacks any tenant information that was previously given. Here's a picture of what that would look like:

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    The MultiTenancyMiddlewareErrorPageBuilder is used to handle inactive and non-existent tenants.

    It will respond to an error page by default, you can change it if you want, eg: only output the error log and continue ASP NET Core's request pipeline.

    Configure<AbpAspNetCoreMultiTenancyOptions>(options =>
    {
        options.MultiTenancyMiddlewareErrorPageBuilder = async (context, exception) =>
        {
            // Handle the exception.
    
            // Return true to stop the pipeline, false to continue.
            return true;
        };
    });
    
Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11