Azure-Functions icon indicating copy to clipboard operation
Azure-Functions copied to clipboard

Deployment keep failing

Open RJJ95 opened this issue 4 years ago • 13 comments

Hi there,

I've created a Linux Function App in a Consumption plan. I'm currently deploying using a connection to Github. For some reason every time I'm trying to deploy it fails with the following message:

Generating summary of Oryx build Deployment Log file does not exist in /tmp/oryx-build.log The logfile at /tmp/oryx-build.log is empty. Unable to fetch the summary of build Deployment Failed. deployer = GITHUB_ZIP_DEPLOY deploymentPath = Functions App ZipDeploy. Extract zip. Remote build. Error: Failed to deploy web package to App Service. Error: Execution Exception (state: PublishContent) (step: Invocation) Error: When request Azure resource at PublishContent, zipDeploy : Failed to use /home/runner/work/_temp/temp_web_package_01787711583626872.zip as ZipDeploy content Error: Package deployment using ZIP Deploy failed. Refer logs for more details. Error: Deployment Failed!

Now I've tried deploying using the following ways:

Via VS Code Via the command line Via Github Actions I keep getting the same error message. Also, the Azure Function is about as fresh as it can get. Newly created from the Azure Portal and als tried from the command line.

The first time I deploy it works, but the afterwards it keeps failing. How should I proceed here?

RJJ95 avatar Oct 25 '22 06:10 RJJ95

@RJJ95 Please use the below sample SO link for more information. https://stackoverflow.com/questions/72554813/unable-to-deploy-basic-example-httprequest1-to-azure-function-using-vscode-pytho If you still face the issue, please comment with the error msg you receive,

ramya894 avatar Oct 25 '22 07:10 ramya894

@ramya894 , thanks for your reply. Unfortunately I already tried the mentioned options. I see the following message in the deployment logs:

Successfully parsed SCM credential from publish-profile format. Using SCM credential for authentication, GitHub Action will not perform resource validation. Successfully acquired app settings from function app (with SCM credential)! Will archive . into /home/runner/work/_temp/temp_web_package_2443264159027716.zip as function app content Will use Kudu https:///api/zipdeploy to deploy since publish-profile is detected. Setting SCM_DO_BUILD_DURING_DEPLOYMENT in Kudu container to true Update using Client.updateAppSettingViaKudu Response with status code 204 App setting SCM_DO_BUILD_DURING_DEPLOYMENT propagated to Kudu container Setting ENABLE_ORYX_BUILD in Kudu container to false Update using Client.updateAppSettingViaKudu Response with status code 204 App setting ENABLE_ORYX_BUILD propagated to Kudu container Package deployment using ZIP Deploy initiated. Updating submodules. Preparing deployment for commit id '00497852-0'. PreDeployment: context.CleanOutputPath False PreDeployment: context.OutputPath /home/site/wwwroot Repository path is /tmp/zipdeploy/extracted Running oryx build... Command: oryx build /tmp/zipdeploy/extracted -o /home/site/wwwroot --platform nodejs --platform-version ~16 Operation performed by Microsoft Oryx, https://github.com/Microsoft/Oryx You can report issues at https://github.com/Microsoft/Oryx/issues

Oryx Version: 0.2.20210120.1, Commit: 66c7820d7df527aaffabd2563a49ad57930999c9, ReleaseTagName: 20210120.1

Build Operation ID: |fobbjx9Jh14=.7ba5fe28_ Repository Commit : 00497852-0566-46df-b53b-a3eec6c1e567

Detecting platforms... Detected following platforms: nodejs: 16.14.2

Source directory : /tmp/zipdeploy/extracted Destination directory: /home/site/wwwroot

Using Node version: v16.14.2

Using Npm version: 8.5.0

Running 'npm install --unsafe-perm'...

up to date, audited 129 packages in 896ms

9 packages are looking for funding run npm fund for details

found 0 vulnerabilities

Running 'npm run build'...

[email protected] build tsc

/tmp/zipdeploy/extracted/node_modules/.bin/tsc: 1: /tmp/zipdeploy/extracted/node_modules/.bin/tsc: ../typescript/bin/tsc: not found /tmp/zipdeploy/extracted/node_modules/.bin/tsc: 1: /tmp/zipdeploy/extracted/node_modules/.bin/tsc: ../typescript/bin/tsc: not found\n/opt/Kudu/Scripts/starter.sh oryx build /tmp/zipdeploy/extracted -o /home/site/wwwroot --platform nodejs --platform-version ~16

Generating summary of Oryx build Deployment Log file does not exist in /tmp/oryx-build.log The logfile at /tmp/oryx-build.log is empty. Unable to fetch the summary of build Deployment Failed. deployer = GITHUB_ZIP_DEPLOY deploymentPath = Functions App ZipDeploy. Extract zip. Remote build. Error: Failed to deploy web package to App Service. Error: Execution Exception (state: PublishContent) (step: Invocation) Error: When request Azure resource at PublishContent, zipDeploy : Failed to use /home/runner/work/temp/temp_web_package2443264159027716.zip as ZipDeploy content Error: Package deployment using ZIP Deploy failed. Refer logs for more details. Error: Deployment Failed!

RJJ95 avatar Oct 25 '22 07:10 RJJ95

When I use a Windows OS it works, but I need the Linux one unfortunately.

RJJ95 avatar Oct 25 '22 14:10 RJJ95

I found it has to do with adding the option scm-do-build-during-deployment: true. I do need this to be true, so I added a couple of other options. This is my semi-auto generated build yaml for using Github actions:

name: Build and deploy Node.js project to Azure Function App - lb-d-fa-linux

on:
  push:
    branches:
      - main
  workflow_dispatch:

env:
  AZURE_FUNCTIONAPP_PACKAGE_PATH: "." # set this to the path to your web app project, defaults to the repository root
  NODE_VERSION: "16.x" # set this to the node version to use (supports 8.x, 10.x, 12.x)

jobs:
  build-and-deploy:
    runs-on: ubuntu-latest
    steps:
      - name: "Checkout GitHub Action"
        uses: actions/checkout@v2

      - name: Setup Node ${{ env.NODE_VERSION }} Environment
        uses: actions/setup-node@v1
        with:
          node-version: ${{ env.NODE_VERSION }}

      - name: "Resolve Project Dependencies Using Npm"
        shell: bash
        run: |
          pushd './${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}'
          npm install
          npm run build --if-present
          npm run test --if-present
          popd

      - name: "Run Azure Functions Action"
      uses: Azure/functions-action@v1
        id: fa
        with:
          app-name: "lb-d-fa-linux"
          slot-name: "Production"
          package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}
          publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_A5413AC6097F4B21B4A709C270747826 }}
          scm-do-build-during-deployment: true
          enable-oryx-build: true
          respect-funcignore: true

Now when I run this it also fails for some reason. I saw some other thread saying something about the Azure/functions-action@v1 still switching scm-do-build-during-deployment: true to false, but I haven't figured it out yet. Do you guys have any suggestions?

RJJ95 avatar Oct 25 '22 16:10 RJJ95

One more thing, I also added the following app settings to my function app:

  • ENABLE_ORYX_BUILD: true
  • SCM_DO_BUILD_DURING_DEPLOYMENT: true
  • WEBSITE_RUN_FROM_PACKAGE: 0

What should I try?

RJJ95 avatar Oct 25 '22 17:10 RJJ95

@patelchandni Could you please look into the above issue. Thanks.

ramya894 avatar Nov 01 '22 14:11 ramya894

@ramya894 You already have build step in your pipeline so no need for remote build. So please make these changes and redeploy:

  1. Set function app settings to: ENABLE_ORYX_BUILD: false SCM_DO_BUILD_DURING_DEPLOYMENT: false WEBSITE_RUN_FROM_PACKAGE: 0
  2. In the .yaml pipeline for functions-action set: scm-do-build-during-deployment: false enable-oryx-build: false

patelchandni avatar Nov 01 '22 16:11 patelchandni

@RJJ95 Please make changes to your code as mentioned above and try redeploying.

ramya894 avatar Nov 02 '22 06:11 ramya894

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

ghost avatar Nov 06 '22 09:11 ghost

I have the same problem after moving my function which was created via the portal in my msdn subscription into another subscription and deploying with terraform. I have tried the following:

@ramya894 You already have build step in your pipeline so no need for remote build. So please make these changes and redeploy:

  1. Set function app settings to: ENABLE_ORYX_BUILD: false SCM_DO_BUILD_DURING_DEPLOYMENT: false WEBSITE_RUN_FROM_PACKAGE: 0
  2. In the .yaml pipeline for functions-action set: scm-do-build-during-deployment: false enable-oryx-build: false

This is where it fails:

Creating placeholder blob for linux consumption function app... Malformed SCM_RUN_FROM_PACKAGE when uploading built content. Deployment Failed. deployer = GITHUB_ZIP_DEPLOY deploymentPath = Functions App ZipDeploy. Extract zip. Error: Failed to deploy web package to App Service. Error: Execution Exception (state: PublishContent) (step: Invocation) Error: When request Azure resource at PublishContent, zipDeploy : Failed to use /home/runner/work/_temp/temp_web_package_45096662348567973.zip as ZipDeploy content Error: Package deployment using ZIP Deploy failed. Refer logs for more details. Error: Deployment Failed!

richgo avatar Feb 28 '23 07:02 richgo

@richgo Are you using Managed Identity by any chance? Do you have app setting "AzureWebJobsStorage" set correctly?

patelchandni avatar Feb 28 '23 17:02 patelchandni

@patelchandni i have the exact same error as the gentleman above Creating placeholder blob for linux consumption function app... Malformed SCM_RUN_FROM_PACKAGE when uploading built content. Deployment Failed. deployer = GITHUB_ZIP_DEPLOY_FUNCTIONS_V1 deploymentPath = Functions App ZipDeploy. Extract zip. Error: Failed to deploy web package to App Service. Error: Execution Exception (state: PublishContent) (step: Invocation) Error: When request Azure resource at PublishContent, zipDeploy : Failed to use /home/runner/work/_temp/temp_web_package_2607110357604381.zip as ZipDeploy content Error: Package deployment using ZIP Deploy failed. Refer logs for more details. Error: Deployment Failed! and my AzureWebJobsSecretStorageType is set to "files", is that wrong?

Zoraxis avatar Jan 24 '24 12:01 Zoraxis

@ramya894 You already have build step in your pipeline so no need for remote build. So please make these changes and redeploy:

  1. Set function app settings to: ENABLE_ORYX_BUILD: false SCM_DO_BUILD_DURING_DEPLOYMENT: false WEBSITE_RUN_FROM_PACKAGE: 0
  2. In the .yaml pipeline for functions-action set: scm-do-build-during-deployment: false enable-oryx-build: false

helped my case where I try to deploy to a deployment slot with publish profile using github action, where the build step was performed earlier in the pipeline, in my app setting I did specify those 3 settings incorrectly

entee28 avatar Dec 02 '24 10:12 entee28