webapps-deploy: Failed to deploy web package to App Service using ZIP Deploy

I have encountered an error while using the azure/webapps-deploy@v2

beta-deploy.yaml:

name: Develop - Build and deploy to Azure Web App 

on:
  push:
    branches: ["develop"]
  workflow_dispatch:
    
jobs:
  build:
    runs-on: windows-latest

    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v3
        with:
          node-version: 16
      - name: Set up .NET Core
        uses: actions/setup-dotnet@v1
        with:
          dotnet-version: '6.0.x'
          include-prerelease: true

      - name: Install npm
        run: |
          cd src/Web/
          npm install
      - name: Build WEB
        run: dotnet build ./src/Web --configuration Debug

      - name: Upload artifact for deployment job WEB
        uses: actions/upload-artifact@v2
        with:
          name: .net-app-web
          path: ${{env.DOTNET_ROOT}}/web

      - name: Publish API
        run: dotnet publish  ./src/PublicApi/ -c Release -o ${{env.DOTNET_ROOT}}/api

      - name: Upload artifact for deployment job API
        uses: actions/upload-artifact@v2
        with:
          name: .net-app-api
          path: ${{env.DOTNET_ROOT}}/api
    
  deploy:
    runs-on: windows-latest
    needs: build
    environment:
      name: 'Production'
      url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}

    steps:
      - name: Download artifact from build job - WEB
        uses: actions/download-artifact@v2
        with:
          name: .net-app-web

      - name: Deploy to Azure Web App
        id: deploy-to-webapp-web
        uses: azure/webapps-deploy@v2
        with:
          app-name: 'webapp-XXXXXXXXX'
          slot-name: 'Production'
          publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_DEF5E7EC3B4649958EFAF575DDB49C91 }}
          package: .
          

And the main issue happens in the deploy part where once the build is complete and it tries to do the deploy the output looks like this

Output

Using the following command to generate deployment script: 'azure site deploymentscript -y --no-dot-deployment -r "C:\local\Temp\zipdeploy\extracted" -o "C:\home\site\deployments\tools" --basic --sitePath "C:\local\Temp\zipdeploy\extracted"'.
C:\PROGRA~2\SITEEX~1\NODEAP~1\296456~1.8\nodejs\build\src\Loader.js:153
                ...StatusLogger.DEFAULT_STATUS,
                ^^^

SyntaxError: Unexpected token ...
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:542:28)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:[12](https://github.com/vacha/nanosun-systems/actions/runs/4701623399/jobs/8338345568#step:3:13))
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at module.js:669:12
    at Array.forEach (native)
C:\PROGRA~2\SITEEX~1\NODEAP~1\296456~1.8\nodejs\build\src\Loader.js:[15](https://github.com/vacha/nanosun-systems/actions/runs/4701623399/jobs/8338345568#step:3:16)3\r\n                ...StatusLogger.DEFAULT_STATUS,\r\n                ^^^\r\n\r\nSyntaxError: Unexpected token ...\r\n    at createScript (vm.js:56:10)\r\n    at Object.runInThisContext (vm.js:97:10)\r\n    at Module._compile (module.js:542:28)\r\n    at Object.Module._extensions..js (module.js:579:10)\r\n    at Module.load (module.js:487:32)\r\n    at tryModuleLoad (module.js:446:12)\r\n    at Function.Module._load (module.js:438:3)\r\n    at Module.require (module.js:497:[17](https://github.com/vacha/nanosun-systems/actions/runs/4701623399/jobs/8338345568#step:3:18))\r\n    at module.js:669:12\r\n    at Array.forEach (native)\r\nC:\Program Files (x86)\SiteExtensions\Kudu\100.50331.6[20](https://github.com/vacha/nanosun-systems/actions/runs/4701623399/jobs/8338345568#step:3:21)4\bin\Scripts\starter.cmd "C:\Program Files (x86)\SiteExtensions\Kudu\100.50331.6204\bin\node_modules\.bin\kuduscript.cmd" -y --no-dot-deployment -r "C:\local\Temp\zipdeploy\extracted" -o "C:\home\site\deployments\tools" --basic --sitePath "C:\local\Temp\zipdeploy\extracted"
Deployment Failed.
Error: Failed to deploy web package to App Service.
Error: Deployment Failed, Package deployment using ZIP Deploy failed. Refer logs for more details.

I have no idea what the cause is. If it is on the action part or if it is on our side. Am I missing something?

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 9
  • Comments: 32 (1 by maintainers)

Most upvoted comments

Any chance this can be looked into please? We are also facing this issue.

Just started experiencing this issue as well. Preventing us from deploying to production. Would love some guidance if possible. Thank you!

Just tried, this is still an issue and is preventing our team from publishing critical fixes. Please help!

I also had WEBSITE_NODE_DEFAULT_VERSION pegged to 6.9.1 and deployment mysteriously started failing today with this error. I changed it to ~18 to tie it to the current LTS release, but not tie it to a specific version.

I never set WEBSITE_NODE_DEFAULT_VERSION, don’t actually use Node in the app, and can understand the App Service team not wanting to roll out an update. But they could at least update this tool to emit an error message that says it might be related to this issue and link to a doc.

Can confirm this issue persists. I noticed the apps we have that are having this issue the offending config item was set to 6.9.1 I was able to get it running by removing the WEBSITE_NODE_DEFAULT_VERSION setting completely or by changing it to 16.9.1

Still ongoing on projects I’m inolved in.

In my case I removed the WEBSITE_NODE_DEFAULT_VERSION setting from azure entirely on the deployment slot I was having trouble deploying to. Application Insights might add this setting, and swapping slots might move it to a slot you don’t expect too.

I set WEBSITE_NODE_DEFAULT_VERSION in App Service -> Configuration -> Application Settings to 16.9.1 and it worked for me.

Ok thanks @Ortieez we’ll try that @Graham-getOptimal