Problems accessing a basic Web App on NodeJS

Paul Simon 25 Reputation points
2023-09-08T20:47:08.1866667+00:00

I have tried to create the most basic web app I can think out. I have created it under my personal account, rather than my work account, so no AD involved. I first tried to deploy it from my Git repository. That failed with lots of typescript errors actually in node modules which I obviously cannot change. These should be output as warnings rather than errors since the server runs Ok locally.

I then deployed from VS Code. That seemed to work successfully. However, when I clicked the link to access the web site it just says You do not have permission to view this directory or page.

Given that according to the Authentication section I am the owner of the App, why would I not have access?

This is a API Server rather than a Static Web App so there are no web pages, but I was expecting to be able to add to the URL to make a call and get some JSON back.

There is lots of documentation but I soon get lost in all the Azure specific terminology.

Can anyone tell me what might be wrong, or point me in the direction of a simple set of steps to set up something basic?

Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
1,173 questions
{count} votes

Accepted answer
  1. ajkuma 28,036 Reputation points Microsoft Employee Moderator
    2023-09-27T14:31:20.2933333+00:00

    To benefit the community, posting the summary of our discussion offline.

    Scenario: Problems accessing a basic Web App on NodeJS

    Issue: Facing an application error, unauthorized error and 4xx errors

    Cause: Application error and port issue

    Resolution: Set the port in the application setting

    Reference:

    https://azureossd.github.io/2023/03/24/Default-exposed-ports-of-Azure-App-Service-Linux-Blessed-Images/

    https://azureossd.github.io/2023/02/15/Whats-the-difference-between-PORT-and-WEBSITES_PORT/

    Paul Simon, thanks for your collaboration!


2 additional answers

Sort by: Most helpful
  1. ajkuma 28,036 Reputation points Microsoft Employee Moderator
    2023-09-12T21:14:40.3033333+00:00

    Firstly, apologies for the delayed response from over the weekend and any inconvenience with this issue.  

    Just to clarify, are you leveraging Azure App Service WebApp or Azure Static WebApps?  

    -The error output typically indicates you are missing a web.config file. When using the App Service Build engine, one will be generated, but if using a service like GitHub Actions, you will need to configure your own web.config.

    -You may also inspect the log files from the browser at https://<app-name>.scm.azurewebsites.net/api/logs/docker

    To fetch more details about the issue, you may try these:

    -You may leverage App Service diagnostics from Azure Portal> Navigate to your App Service app in the Azure Portal. (screenshot below) In the left navigation, click on Diagnose and solve problems - Review - “Configuration and Management and “Availability and Performance”  options.

    User's image

    Kindly let us know how it goes, I'll follow-up with you further.

    For more information, checkout these docs:
    #you-do-not-have-permission-to-view-this-directory-or-page

    Reference : Troubleshooting Common iisnode Issues


  2. Bruce (SqlWork.com) 77,686 Reputation points Volunteer Moderator
    2023-09-13T22:59:44.55+00:00

    you don't say what template you used to create the node app. but if you got typescript errors, on deployment, you probably require a build tool. so you probably have to

    npm run build

    to build a /dist (or some name) folder.

    after the build, cd to the /dist folder and type

    node server.js

    the site should run error free.

    now deploy this folder to azure with your favorite tool. vscode, cli, PowerShell, etc


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.