Open Closed

Admin user menu not showing on tiered app in dev / production, and logged in with same menu issue but not authenticated in production Azure deployment slots. #7716


User avatar
0
okains created
  • ABP Framework version: v8.2
  • UI Type: Blazor Server
  • 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:

I am working through a CI / CD implementation using Azure Deployment slots. I have a tiered application that I am trying to get deployed correctly. This is just a basic, no changes, out of the box 3 tier application generated by ABPSuite that I use as a base dev environment for testing.

First problem is that I can not see the full menu for the admin user in the tiered app on neither dev nor production. However in dev everything works as expected, I can create users, and I am authenticated as admin ( it seems ).

For reference, I created a single tier app, and I see the admin user menu as I would expect:

So I would expect to see this menu in my tiered app. They were created exactly the same time, same 8.2 version number, no code updates, just out of the box ABP. But I do not get the user / admin menu in my fresh and clean 3 tier app.

The real issue here is when I deploy a 3 tier app using Azure Deployment Slots to a staging environment on Azure. I can log in OK, and I get the same no options Admin menu as I got in my local dev environment:

However I can’t see any admin menu, and I get an Unauthorized exception after trying to do anything. Even though I seem to be logged in as the admin user.

After Refresh:

This to me seems like a configuration issue, but I can not seem to see any difference in config between environments.

Any insight would be much appreciated.

Thanks,

Karim Ainsworth


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

    hi

    Please share your website URL and a test user with a password.

    I will check it online.

    Thanks

    liming.ma@volosoft.com

  • User Avatar
    0
    okains created

    Hi,

    I have sent those details to your email address.

    Thanks,

    Karim

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    I have reproduced the problem. Can you also share the debug logs of your staging authserver and blazor apps?

    Thanks

  • User Avatar
    0
    okains created

    Hi,

    Logs and configuration all sent to your email address.

    Thanks

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    The URL in appsettings.json is still localhost.

    https://fbd-staging.azurewebsites.net/appsettings.json

    And can you share the Logs.txt files?

    public class Program
    {
        public async static Task<int> Main(string[] args)
        {
            Log.Logger = new LoggerConfiguration()
                .MinimumLevel.Debug()
                .MinimumLevel.Override("Microsoft.EntityFrameworkCore", LogEventLevel.Warning)
                .Enrich.FromLogContext()
                .WriteTo.Async(c => c.File("Logs/logs.txt"))
                .WriteTo.Async(c => c.Console())
                .CreateLogger();
    
    
  • User Avatar
    0
    okains created

    Hi,

    OK I just emailed you the full logs.txt files for both services.

    The appsettings.json config should be overridden by the AppService Environment Variables config, I had sent that config to you in the previous email.

    I can send a full Environment Dump from Kudu if you think that will help?

    Thanks,

    Karim

  • User Avatar
    0
    okains created

    Also just emailed the EnvVars dumps from Kudu...

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    The error is:

    [ERR] An unhandled exception has occurred while executing the request.
    Volo.Abp.Http.Client.AbpRemoteCallException: An error occurred during the ABP remote HTTP request. (The operation was canceled.) See the inner exception for details.
     ---> System.Threading.Tasks.TaskCanceledException: The operation was canceled.
     ---> System.Threading.Tasks.TaskCanceledException: The operation was canceled.
     ---> System.IO.IOException: Unable to read data from the transport connection: The I/O operation has been aborted because of either a thread exit or an application request..
     ---> System.Net.Sockets.SocketException (995): The I/O operation has been aborted because of either a thread exit or an application request.
    
    System.Net.Sockets.SocketException (995): The I/O operation has been aborted because of either a thread exit or an application request.
    

    This should be related to the network of the running environment, I have no experience with this.

  • User Avatar
    0
    okains created

    Hi,

    I noticed something just now, I had a mistake in the config. I had shifted this entire app to InteractiveServer, however I left 1 setting at InteractiveAuto by mistake!

    I have fixed that issue and redeployed and it seems to have fixed the 404 page flash that was happening. However the initial issues are still there:

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    ok, Please re-share the logs.txt of your applicaitons. Thanks

  • User Avatar
    0
    okains created

    Ok, just emailed them to you, thanks.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Do you have the logs.txt of fbd-api-staging website?

  • User Avatar
    0
    okains created

    Hi yeah I just emailed them, thanks.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    An error occurred using the connection to database 'Flo3BlazorDev-staging' on server 'tcp:xxxx.database.windows.net,1433'.[ERR] System.Threading.Tasks.TaskCanceledException: A task was canceled.

    Please set the log level to Debug of your API website to see more logs.

    https://abp.io/support/questions/7716/Admin-user-menu-not-showing-on-tiered-app-in-dev--production-and-logged-in-with-same-menu-issue-but-not-authenticated-in-production-Azure-deployment-slots#answer-3a146c3c-05eb-d49a-90e7-9e1f5f54b502

    Thanks.

  • User Avatar
    0
    okains created

    Hi,

    I have set the log level to Debug for all 3 projects:

    And emailed you the log files.

    Thanks,

    Karim

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    https://github.com/abpframework/abp/issues/20013#issuecomment-2160025249

    https://abp.io/support/questions/7180/Deploying-an-ABP-tiered-project-to-mutliple-docker-containers#answer-3a1297a0-ff1b-ca76-c30d-0b6e0f62253d

    Failed to validate the token.
    IDX10204: Unable to validate issuer. validationParameters.ValidIssuer is null or whitespace AND validationParameters.ValidIssuers is null or empty.
    

    Can you share a access_token?

  • User Avatar
    0
    okains created

    Sure, this is what I have in my OpenIddictTokens db ( staging ):

    I have emailed you the latest authcode.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    This is an encrypted token. You can add a middle to write the bearer token header to log in your API website,

    app.Use(async (httpContext, next) =>
    {
        var bearerToken = httpContext.Request.Headers["Authorization"].ToString();
        var logger = httpContext.RequestServices.GetRequiredService<ILogger<MyProjectNameWebModule>>();
        logger.LogInformation($"Bearer Token: {bearerToken}");
        await next(httpContext);
    });
    
  • User Avatar
    0
    okains created

    Hi,

    I added the code, but didn't get anything logged. Can you confirm that I have put this in the right place? I am in my APIHost project, in the OnApplicationInitialization method:

    added to the end:

    Ran the project, went through the normal steps, logged in, looked at the profile, got a 401 Unauthorized. So I am assuming it should have logged the token ?

    Thanks,

    Karim

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Add this after app.UseAuthentication()

  • User Avatar
    0
    okains created

    Still can't see this in the Staging logs on Azure, but I can see the log entry it in Dev now, but getting a Bearer was not Authenticated message and no token:

    However I do seem to be logged in, at least I can do admin things. However the Admin Profile menu isn't there. This is basically the initial question!

    So I am assuming even if the logging was working on Staging that the same Bearer was not Authenticated result that I am getting in dev.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Can you share the new logs of API website?

    Thanks.

  • User Avatar
    0
    okains created

    Hi,

    I just emailed the log files for all 3 services.

    Thanks,

    Karim

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Can you upload your project code to the Github private repository?

    I will check your code . My GitHub user name is maliming Thanks.

  • User Avatar
    0
    okains created

    Hi,

    I have just given you access, thanks.

Made with ❤️ on ABP v9.0.0-preview Updated on September 19, 2024, 10:13