Azure / functions-action

Enable GitHub developers to deploy to Azure Function Apps using GitHub Actions
MIT License
156 stars 76 forks source link

Timeout when deploy Node/Java Functions in linux Azure function #162

Closed jlrosende closed 1 year ago

jlrosende commented 1 year ago

When I try to deploy new code to an azure function. With Node or Java code I have a timeout issue.

This happens randomly, and I not able to replicate the error properly.

This is the output of the action. with the error

Using RBAC for authentication, GitHub Action will perform resource validation.
Successfully acquired site configs from function app!
Detected function app sku: ***
Successfully acquired app settings from function app (RBAC)!
Detected function app language: Java
Will archive ./code/***/target/azure-functions/*** into /home/runner/work/_temp/temp_web_package_6218868638730215.zip as function app content
Will use https://<scmsite>/api/zipdeploy to deploy since RBAC Azure credential is detected.
Package deployment using ZIP Deploy initiated.
Updating submodules.
Preparing deployment for commit id '5ba10336-1'.
PreDeployment: context.CleanOutputPath False
PreDeployment: context.OutputPath /home/site/wwwroot
Generating deployment script.
Using cached version of deployment script (command: 'azure -y --no-dot-deployment -r "/tmp/zipdeploy/extracted" -o "/home/site/deployments/tools" --basic --sitePath "/tmp/zipdeploy/extracted"').
Running deployment command...
Command: "/home/site/deployments/tools/deploy.sh"
Handling Basic Web Site deployment.
Kudu sync from: '/tmp/zipdeploy/extracted' to: '/home/site/wwwroot'
Copying file: 'host.json'
........
.....
......
Finished successfully.
An unknown error has occurred. Check the diagnostic log for details.
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_6218868638730215.zip as ZipDeploy content
Error:     Package deployment using ZIP Deploy failed. Refer logs for more details.
Error: Deployment Failed!
patelchandni commented 1 year ago

@jlrosende , Is it Linux Consumption plan? Can you share your GitHub workflow? Also, Workflows will change for node and java, and they will have different requirements.

jlrosende commented 1 year ago

we are currently deploy node and java funcitons.

The workflow is simple.

pre-steps:

Then

  1. Login in to azure
  2. Build our app (node npm o java mvn)
  3. Update function configurations
  4. Upload the code with this action

I share the code from the java app deployment pipeline.

      - name: 🗒️ 'Apply Azure Function Config'
        env:
          FUNCTION_APP_NAME: ${{ inputs.AZURE_FUNCTIONAPP_NAME }}
        run: |
          az functionapp config appsettings set -o none --subscription ${{ env.AZURE_SUBSCRIPTION_ID }} --resource-group ${{ inputs.AZURE_FUNCTIONAPP_RESOURCEGROUP }} --name ${{ inputs.AZURE_FUNCTIONAPP_NAME }} --settings "${{ join(fromJson(steps.azf_settings.outputs.settings), '" "') }}"

        # DEPLOY MVN
      - name: 🚀 'Run Azure Functions Action'
        uses: Azure/functions-action@v1
        with:
          app-name: ${{ inputs.AZURE_FUNCTIONAPP_NAME }}
          package: ${{ inputs.AZURE_FUNCTIONAPP_PACKAGE_PATH }}
dgonzalezpulido commented 1 year ago

Same problem here

patelchandni commented 1 year ago

@jlrosende If you are not using Linux consumption plan, then from azure portal set app setting WEBSITE_RUN_FROM_PACKAGE = 1 and redeploy. In your workflow, you are updating app setting right before deployment, which is not recommended as there should be a wait in between.

jlrosende commented 1 year ago

@patelchandni We have WEBSITE_RUN_FROM_PACKAGE = 1 set in all our functions. We need update the configuration of the app before the deployment, because some of the configurations are required for the correct functioning.

I'm open to suggestion to other methods to automate the configuration update.

patelchandni commented 1 year ago

@jlrosende you can add a step before functions-action to add some wait time:

- name: Sleep for 60 seconds
  run: sleep 60s
  shell: bash
jlrosende commented 1 year ago

@patelchandni I try to remove the settings step and the error persist. So the timeout error is other. We saw, in the funtion, the code is deployed and the azure function is running with the new code. The timeout error is possibly caused by the kudu deployment response.

patelchandni commented 1 year ago

@jlrosende based on the logs you shared, it does not seem like you have WEBSITE_RUN_FROM_PACKAGE = 1 set for the app before deployment. Feel free to open a new support request from the Azure portal as this will need your app info. Thank you.

jlrosende commented 1 year ago

@patelchandni I said previously, "We have WEBSITE_RUN_FROM_PACKAGE = 1 set in all our functions.". So the problem is other. I close this issue in lack of solutions, and have the same response two times.