I need help with troubleshooting my GitHub Actions deployment to Azure App Service as I am running on NextJS V14+.

James Hizon 60 Reputation points
2025-02-13T17:45:36.1533333+00:00

I have been testing build and deploy constantly and have been stuck with troubleshooting for past few days while continuing to alter the "workflow file."

I have dabbled with additionally testing different "Startup command" sequence like instead of having "npm install && npm run build && npm run start," I just kept this all to be done on the "Workflow file" for the install and build so I can just run start in my workflow file. This way, I can ensure that we accurately detect my files for zipping and change to correct working directory as is needed with manually updating the "Workflow file." This is my most recent error message:

Run azure/webapps-deploy@v3

Package deployment using OneDeploy initiated.

Error: Failed to deploy web package to App Service.

Error: Deployment Failed, Error: Failed to deploy web package using OneDeploy to App Service.

Service Unavailable (CODE: 503)

App Service Application URL: https://provensuccess-co.azurewebsites.net

And, this is my Workflow file as of recent (try to copy and paste to maybe chatgpt to reformat for readability):

#`` Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy``#`` More GitHub Actions for Azure: https://github.com/Azure/actions ``#`` Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy``#`` More GitHub Actions for Azure: https://github.com/Azure/actions ``name``: ``Build and deploy Node.js app to Azure Web App - provensuccess-co`` ``on``: ``push``: ``branches``: - ``main`` ``workflow_dispatch``: ``permissions``: ``id-token``: ``write #`` Required for OIDC authentication ``contents``: ``read #`` Required to access repository contents ``jobs``: ``build``: ``runs-on``: ``ubuntu-latest`` ``steps``: - ``name``: ``Checkout Code`` ``uses``: ``actions/checkout@v4`` - ``name``: ``Set up Node.js`` ``uses``: ``actions/setup-node@v3`` ``with``: ``node-version``: ``'``18.x``'`` - ``name``: ``Install Dependencies`` ``run``: ``| cd agentic-growth-ai npm ci`` - ``name``: ``Build the Application`` ``run``: ``| cd agentic-growth-ai npm run build`` ``env``: ``OPENAI_API_KEY``: ``${{ secrets.OPENAI_API_KEY }}`` ``#`` Zip the built app and move the zip to the root directory - ``name``: ``Zip Artifact for Deployment`` ``run``: ``| cd agentic-growth-ai zip -r ../release.zip . -x "node_modules/*" # Includes hidden files like .env, .next, etc. ``- ``name``: ``Upload Artifact for Deployment Job`` ``uses``: ``actions/upload-artifact@v4`` ``with``: ``name``: ``node-app`` ``path``: ``release.zip`` - ``name``: ``Verify zip contents`` ``run``: ``unzip -l release.zip`` ``deploy``: ``runs-on``: ``ubuntu-latest`` ``needs``: ``build`` ``environment``: ``name``: ``'``Production``'`` ``url``: ``${{ steps.deploy-to-webapp.outputs.webapp-url }}`` ``steps``: - ``name``: ``Download Artifact from Build Job`` ``uses``: ``actions/download-artifact@v4`` ``with``: ``name``: ``node-app`` ``path``: ``.`` - ``name``: ``List files after artifact download`` ``run``: ``ls -la #`` Should list release.zip in the workspace root ``#`` Unzip the artifact before deploying - ``name``: ``Unzip the Release Artifact`` ``run``: ``unzip release.zip -d ./release-unzipped`` ``#`` List files in the unzipped folder to verify - ``name``: ``List files after unzip`` ``run``: ``ls -la ./release-unzipped`` ``#`` Login to Azure using OIDC - ``name``: ``Login to Azure`` ``uses``: ``azure/login@v2`` ``with``: ``client-id``: ``${{ secrets.AZURE_CLIENT_ID }}`` ``tenant-id``: ``${{ secrets.AZURE_TENANT_ID }}`` ``subscription-id``: ``${{ secrets.AZURE_SUBSCRIPTION_ID }}`` ``#`` Deploy the unzipped folder to Azure - ``name``: ``Deploy to Azure Web App`` ``id``: ``deploy-to-webapp`` ``uses``: ``azure/webapps-deploy@v3`` ``with``: ``app-name``: ``'``provensuccess-co``'`` ``package``: ``release.zip`` - ``name``: ``Restart Azure App Service`` ``run``: ``az webapp restart --name provensuccess-co --resource-group provensuccess-rg

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
42,798 questions
{count} votes

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.