Azure error when deploying Angular front end to webapp

hpbcrowe 51 Reputation points
2022-07-13T06:02:43.523+00:00

I have deployed a SQL server DB on Azure, along with a .NET API they both work and communication with each other. When I run the Angular front end locally the full stack works the local front end talks to the API, database on Azure. I tried to deply the Angular front end to Azure the deployment gets past creating the zip package... says the size of the zip package and then says an error has occured but doesn't say what the error is. This is the output window:
220237-azureangularerror.jpg

This is what the Azure Activity Log Window says:
220247-azureactivitylog.jpg

When I click on that link this is the webpage it displays:

220229-website.jpg

It tells me that an error has occured but doesn't give me a number or what error occurred.

I am using VS Code it is the latest version.

Any ideas on what the error could be or where to find what it is?
How can I fix this error when I find out what it is?

Thanks in advance for your help.

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,931 questions
{count} votes

2 answers

Sort by: Most helpful
  1. ajkuma 28,036 Reputation points Microsoft Employee Moderator
    2022-07-14T19:07:47.73+00:00

    hpbcrowe-4216. What App Service version are you leveraging? (Windows or Linux)

    Starting from Node 14 LTS, the container doesn't automatically start your app with PM2.
    To start your app with PM2, set the startup command to pm2 start <.js-file-or-PM2-file> --no-daemon. Be sure to use the --no-daemon argument because PM2 needs to run in the foreground for the container to work properly.

    On Azure Portal, navigate to your App Service > Configuration
    Under Configuration, select the tab > General Settings

    On the Startup Command field, enter the following command:
    pm2 serve /home/site/wwwroot/dist/projectname --no-daemon –spa
    or
    pm2 serve /home/site/wwwroot --no-daemon –spa

    Additionally , take a look at the step-step instructions on How to deploy Angular app to Azure App Service running Linux from GitHub
    Angular Deployment on App Service Linux

    1 person found this answer helpful.

  2. hpbcrowe 51 Reputation points
    2022-07-15T03:06:42.777+00:00

    I figured out what I had done wrong. I didn't manually select the folder inside of the dist folder when deploying to the app. It wasn't deploying the "zipped folder" to Azure. I re did and then chose "browse" selecting the sub folder in dist and then it worked like a charm.
    Thanks for your help!


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.