actions icon indicating copy to clipboard operation
actions copied to clipboard

`Azure/functions-action@v1` taking 30+ minutes with Github Actions NodeJS Function

Open branburciaga opened this issue 2 years ago • 2 comments

Hi,

Please let me know if this should be in another repo, but I am using the base config in the linked examples for deploying a NodeJS function app to Azure, and our build/deploy GitHub Action Workflow is taking 30+ minutes every single time.

The Github Action gets stuck on Azure/functions-action@v1.

Any ideas why?

Here is my workflow.yml:


# Docs for the Azure Web Apps Deploy action: https://github.com/azure/functions-action
# More GitHub Actions for Azure: https://github.com/Azure/actions

name: Build and Deploy

on:
  push:
    branches:
      - development
  workflow_dispatch:

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

jobs:
  build-and-deploy:
    runs-on: windows-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: pwsh
        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: 'my-func'
          slot-name: 'Production'
          package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}
          publish-profile: ${{ secrets.AZURE_FUNCTIONAPP_PUBLISH_PROFILE_DEV }}

And the Github Action debug logs below. It repeats this over and over:

##[debug]Deployment status: 1 'Building and Deploying 'a8c4f086abf04c2abeb4263447fe38d5'.'. retry after 5 seconds
##[debug]setting affinity cookie ["ARRAffinity=742cff616624b5c1aff4f543417be11e48cb7b9f10b45a143ff7ddcedc6fef4d;Path=/;HttpOnly;Secure;Domain=my-func.scm.azurewebsites.net","ARRAffinitySameSite=742cff616624b5c1aff4f543417be11e48cb7b9f10b45a143ff7ddcedc6fef4d;Path=/;HttpOnly;SameSite=None;Secure;Domain=my-func.scm.azurewebsites.net"]
##[debug][GET] https://my-func.scm.azurewebsites.net/api/deployments/latest?deployer=GITHUB_ZIP_DEPLOY_FUNCTIONS_V1&time=2023-05-24_18-31-48Z
##[debug]POLL URL RESULT: {"statusCode":202,"statusMessage":"Accepted","headers":{"content-length":"755","connection":"close","content-type":"application/json; charset=utf-8","date":"Wed, 24 May 2023 18:59:06 GMT","server":"Microsoft-IIS/10.0","cache-control":"no-cache","expires":"-1","location":"https://my-func.scm.azurewebsites.net/api/deployments/latest?deployer=GITHUB_ZIP_DEPLOY_FUNCTIONS_V1&time=2023-05-24_18-31-48Z","pragma":"no-cache","retry-after":"30","x-ms-request-id":"da171a94-b4ee-4bea-b699-ad6d8d01447d","x-aspnet-version":"4.0.30319","x-powered-by":"ASP.NET"},"body":{"id":"a8c4f086abf04c2abeb4263447fe38d5","status":1,"status_text":"Building and Deploying 'a8c4f086abf04c2abeb4263447fe38d5'.","author_email":"N/A","author":"N/A","deployer":"GITHUB_ZIP_DEPLOY_FUNCTIONS_V1","message":"{\"type\":\"deployment\",\"sha\":\"89a11cc5b0e874124e291836bd7e1eba2ddc46ab\",\"repoName\":\"my-repo\",\"actor\":\"<my-name>\",\"slotName\":\"production\"}","progress":"Running deployment command...","received_time":"2023-05-24T18:32:23.5766618Z","start_time":"2023-05-24T18:32:24.6246668Z","end_time":null,"last_success_end_time":null,"complete":false,"active":false,"is_temp":false,"is_readonly":true,"url":null,"log_url":null,"site_name":"my-func","provisioningState":"InProgress"}}

branburciaga avatar Jun 06 '23 20:06 branburciaga

Hi @branburciaga It has been some time but where you able to find a solution to this issue? I am facing the same. :( Thanks!

MisterPellino avatar Nov 18 '24 18:11 MisterPellino

Hi @branburciaga It has been some time but where you able to find a solution to this issue? I am facing the same. :( Thanks!

If I recall correctly, I think I solved this by going into the function app within the Azure portal and adding the following Environment Variable:

WEBSITE_RUN_FROM_PACKAGE = 1

Used to take me 30+ minutes to deploy. Now it's under 3 minutes.

DeckardCain001 avatar Nov 19 '24 00:11 DeckardCain001