Context : I have a GitHub Action that deploys an Azure Function. It's crashing every time someone is pushing to 'dev' branch. The only manual "workaround" I found that works is the following;
- Go to Azure's Function App > Configuration > Application Settings
- Remove WEBSITE_RUN_FROM_PACKAGE=1 configuration
- Rerun all jobs on GitHub Actions (succeeds like this)
- Add WEBSITE_RUN_FROM_PACKAGE=1 configuration again, otherwise I'm stuck in a login loop using msal (NodeJS)
Note that I have two environments. One is 'dev' and the other one is 'prod'.
GitHub Action failed job description :
Run Azure/[email protected]
with:
app-name: myapi
package: ./functionsApi
publish-profile: ***
slot-name: dev
scm-do-build-during-deployment: true
enable-oryx-build: false
respect-pom-xml: false
respect-funcignore: false
env:
AZURE_FUNCTIONAPP_NAME: myapi
AZURE_FUNCTIONAPP_SLOT: dev
AZURE_FUNCTIONAPP_PACKAGE_PATH: ./functionsApi
AZURE_FUNCTIONAPP_PUBLISH_PROFILE: ***
NODE_VERSION: 16.x
Successfully parsed SCM credential from old publish-profile format.
Using SCM credential for authentication, GitHub Action will not perform resource validation.
Sucessfully acquired app settings from function app (with SCM credential)!
Will archive ./functionsApi into D:\a\_temp\temp_web_package_5053591759469989.zip as function app content
Will use Kudu https://<scmsite>/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.
Error: Failed to deploy web package to App Service.
Successfully updated deployment History at https://REMOVEDpi-dev.scm.azurewebsites.net/api/deployments/d3799f4XXX933eaa14f3663f3ebdfa67f9732d7b175b1690836786357
Error: Execution Exception (state: PublishContent) (step: Invocation)
Error: When request Azure resource at PublishContent, zipDeploy : Failed to use D:\a\_temp\temp_web_package_5053591759469989.zip as ZipDeploy content
Error: Failed to deploy web package to App Service.
Internal Server Error (CODE: 500)
Error: Error: Failed to deploy web package to App Service.
Internal Server Error (CODE: 500)
at Kudu.<anonymous> (D:\a\_actions\Azure\functions-action\v1.3.2\node_modules\azure-actions-appservice-rest\Kudu\azure-app-kudu-service.js:175:23)
at Generator.next (<anonymous>)
at fulfilled (D:\a\_actions\Azure\functions-action\v1.3.2\node_modules\azure-actions-appservice-rest\Kudu\azure-app-kudu-service.js:5:58)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
Error: Deployment Failed!
myapp/.github/workflows/dev.node.js-functionapp-on-azure.yml :
name: (DEV) Deploy Node.js project to Azure Function App
on:
push:
branches:
- dev
env:
AZURE_FUNCTIONAPP_NAME: myapp
AZURE_FUNCTIONAPP_SLOT: dev
AZURE_FUNCTIONAPP_PACKAGE_PATH: "./functionsApi"
AZURE_FUNCTIONAPP_PUBLISH_PROFILE: "${{ secrets.AZURE_FUNCTIONAPP_PUBLISH_PROFILE_DEV }}"
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: windows-latest
environment: dev
steps:
- name: "Checkout GitHub Action"
uses: actions/checkout@master
- name: "Log env variables"
run: |
echo "AZURE_FUNCTIONAPP_NAME: ${{ env.AZURE_FUNCTIONAPP_NAME }}"
echo "AZURE_FUNCTIONAPP_SLOT: ${{ env.AZURE_FUNCTIONAPP_SLOT }}"
echo "GITHUB_WORKSPACE: ${{ github.workspace }}"
- 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: pwsh
run: |
pushd './${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}'
npm install --force
npm run build --if-present
popd
- name: "Run Azure Functions Action"
uses: Azure/[email protected]
id: fa
with:
app-name: ${{ env.AZURE_FUNCTIONAPP_NAME }}
package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}
publish-profile: ${{ env.AZURE_FUNCTIONAPP_PUBLISH_PROFILE }}
slot-name: ${{ env.AZURE_FUNCTIONAPP_SLOT }}
scm-do-build-during-deployment: true
enable-oryx-build: false
# For more samples to get started with GitHub Action workflows to deploy to Azure, refer to https://github.com/Azure/actions-workflow-samples







