skip to Main Content

I’m trying to deploy a newly created Azure Function to a linux Azure Function app. For some reason this keeps failing, even though the function and app have been newly created. I’ve tried using the azure cli, VS Code, and Github Actions, but it keeps failing. When I deploy the same function to a Windows Functions app it all goes smoothly. Below is the error output:

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 foundn/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!

Does anyone know how to fix this? I need to make sure my app is being built on the server, and that’s not possible using a Windows OS as far as I know. It’s this setting: "azureFunctions.scmDoBuildDuringDeployment": true

2

Answers


  1. Created the Azure Node JS Function App in VS Code and Linux Function App in the Azure Portal.
    Checked with these options such as VS Code deployment, CLI:

    1. VS Code deployment output:
    10:28:37 AM krishnodejsfunapp: Starting deployment...
    10:28:41 AM krishnodejsfunapp: Creating zip package...
    10:28:41 AM krishnodejsfunapp: Uploading zip package to storage container...
    10:28:41 AM krishnodejsfunapp: Zip package size: 1.88 kB
    10:28:47 AM krishnodejsfunapp: Deployment successful.
    10:28:47 AM krishnodejsfunapp: Started postDeployTask "npm install (functions)".
    10:28:59 AM krishnodejsfunapp: Syncing triggers...
    10:29:04 AM krishnodejsfunapp: Querying triggers...
    10:29:09 AM krishnodejsfunapp: HTTP Trigger Urls:
    HttpTrigger1: https://krishnodejsfunapp.azurewebsites.net/api/httptrigger1
    

    enter image description here

    2. Deployment using CLI to 2nd Linux Function App:

    You can refer to one of my solutions for deploying the Function App using Azure CLI cmdlets.

    For the current Function App deployment:

    az login
    az account set --subscription subs-id
    az functionapp config appsettings set --name KrishPy02LinuxFunApp --resource-group HariTestRG --settings "SCM_DO_BUILD_DURING_DEPLOYMENT=true"
    

    It will give the JSON Format output of configuration settings-values from that function app.

    powershell Compress-Archive C:UsersHarisourcereposKrishPyFunApp305 C:UsersHarisourcereposKrishPyFunApp305.zip
    
    az functionapp deployment source config-zip -g HariTestRG -n KrishPy02LinuxFunApp --src "C:/Users/Hari/source/repos/KrishPyFunApp305.zip"
    

    Note:

    1. For zip deployment of Function, we need to enable the configuration setting in Azure Portal Function App SCM_DO_BUILD_DURING_DEPLOYMENT=true as specified in this MS Doc.
    2. For the App Service, WEBSITE_WEBDEPLOY_USE_SCM to true in Application Settings Configuration before deployment.

    If deploying through Azure DevOps, refer to the similar issue in the MS Q& A Forum.

    Login or Signup to reply.
  2. I had a similar issue and the issue seems to be that my Github Action was running on Linux and my Azure Function App was on Windows. When I re-created the Azure Function App on Linux, it worked…

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search