functions-action: Deployment fails from time to time as the actions fails to find the function App

Hi, I am deploying a dotnet-isolated function app using .NET 6 and from time to time the deployment fails with the following error

Using RBAC for authentication, GitHub Action will perform resource validation.
##[debug]try-get AzureCLIAuthorizer
##[debug]"/usr/bin/az" account show
##[debug]"/usr/bin/az" cloud show
##[debug]"/usr/bin/az" account get-access-token
::add-mask::***
##[debug][GET] https://management.azure.com/subscriptions/***/resources?$filter=resourceType EQ 'Microsoft.Web%2FSites' AND name EQ '___FUNCTION__NAME___'&api-version=2016-07-01
Error: Execution Exception (state: ValidateAzureResource) (step: Invocation)
Error:   Resource ___FUNCTION__NAME___ doesn't exist.
Error:     Error: Resource ___FUNCTION__NAME___ doesn't exist.
    at Function.<anonymous> (/home/runner/work/_actions/Azure/functions-action/v1/node_modules/azure-actions-appservice-rest/Utilities/AzureResourceFilterUtility.js:21:23)
    at Generator.next (<anonymous>)
    at fulfilled (/home/runner/work/_actions/Azure/functions-action/v1/node_modules/azure-actions-appservice-rest/Utilities/AzureResourceFilterUtility.js:5:58)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
Error: Deployment Failed!
##[debug]Node Action run completed with exit code 1

I am using RBAC authentication via azure/login@v1. The service principal has contributor permission on the whole subscription. When I use Re-run all jobs for the workflow run, then deployment usually works fine.

I am deploying the function app via terraform, before deployment runs. But it also fails, if the function app is already there and exists for hours. So doesn’t seem to be some kind of “race condition”.

As I deploy IaC via terraform using publish-profiles would be overly complicated I would say. There seems to be no native support in terraform’s azurerm to get the profile.

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 13
  • Comments: 45

Commits related to this issue

Most upvoted comments

I have a Support Ticket open with Azure Support around this. Looks like an ARM sync issue. Good news is they can replicate it, will keep this thread updated as I hear more.

I can confirm this also happens with a function app created with Bicep (haven’t yet figured out what unblocks it)

Same issue here. Interestingly when I run the query that the action uses from the management REST API, it does not list the function in the available resources either, which makes the think this is not an issue with the action, but something else going on elsewhere?

Update: This is definitely an Azure Resource Manager issue, not this action.

Had the same issue, deleting the functions and re-running the pipeline did it, not the best solution in any case…

To bypass the issue I am querying the publish profile via az CLI for now. Here’s an example:

- uses: azure/login@v1
  with:
  creds: <CREDENTIALS>

- name: Retrieve publish profile for deployment
  id: publishProfileRetrieval
  run: |
    publishProfiles=$(az webapp deployment list-publishing-profiles \
      --name "<FUNCTION APP NAME>" \
      --resource-group "<RESOURCE GROUP NAME>" \
      --subscription "<SUBSCRIPTION ID>" --xml)
    echo "::add-mask::$publishProfiles"
    echo "::set-output name=publishProfiles::$publishProfiles"

- name: 'Run Azure Functions Action'
  uses: Azure/functions-action@v1
  with:
    app-name: <FUNCTION APP NAME>
    package: <PATH TO DEPLOYMENT PACKAGE>
    publish-profile: ${{ steps.publishProfileRetrieval.outputs.publishProfiles }}

Wow, no movement since February, really?