Base solution for your next web application
Open Closed

v15.0.0 Upgrade Swagger Broken #12623


User avatar
0
gerryp created

After upgrading to v15.0.0 from v14.2 I noticed that when I launch the back-end, it used to display the swagger login. Now it just gives me an error 404 in light blue text. By changing the URL i can get to the swagger page where it shows all my REST services and their methods, however, there is no longer an option to authenticate. Does anybody have a clue what's going on here? I've looked at my startup.cs and it's basically identical to the v15 baseline startup.cs, and the same with program.cs. Just not sure how to fix this. Thanks.

Markdown is supported
Copy & paste or drag & drop images (max 30 MB per image)

7 Answer(s)
  • User Avatar
    0
    oguzhanagir created
    Support Team

    Hi @gerryp

    If you started the application using the *Host project, could you please open a terminal in the *Host project directory and run either the npm run create-bundles or yarn create-bundles command?

    If this suggestion does not resolve your issue, we would appreciate it if you could share the error message you are receiving or a screenshot, so we can assist you more specifically. Thank you.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    gerryp created

    Thank you for your response. I installed the bundles and there was no change. Here are some photos and some information that hopefully will help you diagnose what is wrong. It appears one of the main issues is simply that it is not going direclty to

    • /startup/AuthConfigurer.cs is identical to v15.0.0
    • /startup/Program.cs is identical to v15.0.0
    • /startup/UnifyOSWebHostModule.cs is identical to v15.0.0
    • /startup/Startup.cs is identical to v15.0.0

    This is what comes up when you just go to http://localhost:44301/

    This image shows what happens when you go to /swagger/ui

    This is what happens when swagger displays the rest services. (note there is no authenticate present)

    I can get to the login page

    I am able to authenticate.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    oguzhanagir created
    Support Team

    Hi @gerryp

    Thank you for providing detailed information. To better understand the problem and provide an accurate answer, could you please tell us if there are any errors in the Logs.txt file located in the App_Data/Logs folder under the *Web.Host project? If so, could you share it with us? This will help us fully understand the issue. We suspect that something was overlooked or missing during the transition process.

    Thank you

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    gerryp created

    I think that's a solid line of analysis. There are some errors in the logs file, but they are specific to some of my REST services, and nothing mentions swagger. I deleted the logs, and then did a new startup and nothing was logged.

    It seems like there's no redirect from the base url to /ui:

    https://localhost:44301/ => 404 https://localhost:44301/Ui => https://localhost:44301/Ui/Login https://localhost:44301/Ui/Login => Displays fine

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    gerryp created

    Still hoping someone might have a clue what is happening given this latest information.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    oguzhanagir created
    Support Team

    Hi @gerryp

    First of all, I apologize for the delay. Thank you for the detailed information you provided. It is very helpful in understanding the situation.

    We kindly ask you to check the HomeController class located under the Controllers folder in your *Web.Host project.

    In the HomeController.Index() method, the behavior depends on the environment:

    In the Development environment, it automatically redirects to the UI Controller Index action (typically /Ui), so the login page loads correctly.

    In non Development environments, it redirects to the value defined in App:HomePageUrl in your appsettings.json. By default, this is set to /index.html. If there is no index.html file under wwwroot, this will result in a 404 error at the root URL.

    To resolve this, you can either:

    Set ASPNETCORE_ENVIRONMENT=Development, or

    Update App:HomePageUrl in appsettings.json to /Ui

    Additionally, in v15, the Swagger authentication flow has changed by design. The Authorize button is no longer shown, and authentication is handled via cookie based login. You can log in at /Ui/Login first, and then navigate to /swagger. Swagger requests will automatically use your authenticated session.

    Please let us know if you need further assistance.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    gerryp created

    I found the problem. In my *.Web.Host.csproj file I changed the launchSetting.json file. I listed the ASPNETCORE_ENVIRONMENT as one of our custom development names (UnifyOSDemo), and not "Development". When I changed it back, it worked.

    Sorry for the confusion.

    "profiles": { "IIS Express": { "commandName": "IISExpress", "launchBrowser": true, "environmentVariables": { "ASPNETCORE_ENVIRONMENT":** "unifyosdemo" => "Development",** . . . "AWS_REGION": "us-west-2", "AWS_DEFAULT_REGION": "us-west-2" } },

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)