Azure / functions-action

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

Failed to fetch Kudu App Settings. Internal Server Error (CODE: 500) #79

Closed tig closed 2 years ago

tig commented 3 years ago

Type: Bug

Enter Task Name: Azure/functions-action@v1

Environment

Issue Description

My app was working for months and I recently tried to update it and got this error.

I have searched the 'net high and low and have found similar errors, but nothing that matches this. None of the suggestions in those Issues/SO posts have helped. Examples:

https://stackoverflow.com/questions/64873031/azure-functions-deploy-from-github-actions-results-in-error-failed-to-fetch-ku

https://docs.microsoft.com/en-us/answers/questions/137869/publish-profile-publishurl-needs-to-be-adjusted-af.html

Here's my Action log:

Run Azure/functions-action@v1
  with:
    app-name: porscheoptioncodes
    slot-name: production
    package: Api/output
    publish-profile: ***
    respect-pom-xml: false
    respect-funcignore: false
    scm-do-build-during-deployment: false
    enable-oryx-build: false
  env:
    AZURE_FUNCTIONAPP_PACKAGE_PATH: Api
    DOTNET_VERSION: 3.1.301
    DOTNET_ROOT: C:\Users\runneradmin\AppData\Local\Microsoft\dotnet
Successfully parsed SCM credential from old publish-profile format.
Using SCM credential for authentication, GitHub Action will not perform resource validation.
Error: Execution Exception (state: ValidateAzureResource) (step: Invocation)
Error:   When request Azure resource at ValidateAzureResource, Get Function App Settings : Failed to acquire app settings from https://<scmsite>/api/settings with publish-profile
Error:     Failed to fetch Kudu App Settings.
Internal Server Error (CODE: 500)
Error:       Error: Failed to fetch Kudu App Settings.
Internal Server Error (CODE: 500)
    at Kudu.<anonymous> (D:\a\_actions\Azure\functions-action\v1\node_modules\azure-actions-appservice-rest\Kudu\azure-app-kudu-service.js:62:23)
    at Generator.next (<anonymous>)
    at fulfilled (D:\a\_actions\Azure\functions-action\v1\node_modules\azure-actions-appservice-rest\Kudu\azure-app-kudu-service.js:5:58)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
Error: Deployment Failed!

My yaml:

    - name: 'Run Azure Functions Action'
      uses: Azure/functions-action@v1
      id: fa
      with:
        app-name: 'porscheoptioncodes'
        slot-name: 'production'
        package: '${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}/output'
        publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_xxx}}

My PublishSettings file which is stored in:

<publishData>
    <publishProfile profileName="PorscheOptionCodes - Web Deploy" 
       publishMethod="MSDeploy" 
       publishUrl="porscheoptioncodes.scm.azurewebsites.net:443" 
       msdeploySite="PorscheOptionCodes" 
       userName="$PorscheOptionCodes" 
       userPWD="<pwd>" 
       destinationAppUrl="http://porscheoptioncodes.azurewebsites.net" 
       SQLServerDBConnectionString="" 
       mySQLDBConnectionString="" 
       hostingProviderForumLink="" 
       controlPanelLink="http://windows.azure.com" 
       webSystem="WebSites">
       <databases />
    </publishProfile>
...
</publishData>

I went to the Azure Portal/Deployment Center and did Disconnect and reconnected, having it re-generate the workflow file.

image

After doing this, I found I had to change 'AZURE_FUNCTIONAPP_PACKAGE_PATHfrom.toApi` (because that's what my client for this function expects).

So now my .yml is:

# 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 dotnet core app to Azure Function App - PorscheOptionCodes

on:
  push:
    branches:
      - master
  workflow_dispatch:

env:
  AZURE_FUNCTIONAPP_PACKAGE_PATH: 'Api' # set this to the path to your web app project, defaults to the repository root
  DOTNET_VERSION: '3.1.301'  # set this to the dotnet version to use

jobs:
  build-and-deploy:
    runs-on: windows-latest
    steps:
    - name: 'Checkout GitHub Action'
      uses: actions/checkout@v2

    - name: Setup DotNet ${{ env.DOTNET_VERSION }} Environment
      uses: actions/setup-dotnet@v1
      with:
        dotnet-version: ${{ env.DOTNET_VERSION }}

    - name: 'Resolve Project Dependencies Using Dotnet'
      shell: pwsh
      run: |
        pushd './${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}'
        dotnet build --configuration Release --output ./output
        popd

    - name: 'Run Azure Functions Action'
      uses: Azure/functions-action@v1
      id: fa
      with:
        app-name: 'PorscheOptionCodes'
        slot-name: 'production'
        package: '${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}/output'
        publish-profile: ${{ secrets.AzureAppService_PublishProfile_xyz }}

The same error occurs.

I'm at my wits end. As I note this was working for months (last working commit was last September). Something changed between then on the Azure side that broke this, I believe.

Happy to be proven wrong, but I don't know how to dive deeper to figure it out.

github-actions[bot] commented 3 years ago

This issue is idle because it has been open for 14 days with no activity.

PMillsArch commented 3 years ago

I am getting a similar problem, but a 403. I'm wondering if this is due to a private endpoint?

github-actions[bot] commented 3 years ago

This issue is idle because it has been open for 14 days with no activity.

fidou commented 3 years ago

same issue here.

PMillsArch commented 3 years ago

Eventually tracked out problem down to a mixture of the blob storage account not having table permission and not being public endpoint. If we have to swap to private endpoint, we'll have to get a private build agent.

github-actions[bot] commented 3 years ago

This issue is idle because it has been open for 14 days with no activity.

brenoalvs commented 3 years ago

Same here, my deploy workflow was working 6 days ago and now it's broken. I did not change anything on the workflow file or Azure

This is the error I'm seeing. Screen Shot 2021-10-15 at 5 37 07 PM

edouardr commented 3 years ago

Hi everyone,

I am having the same issue with my function-app.

Successfully parsed SCM credential from old publish-profile format.
Using SCM credential for authentication, GitHub Action will not perform resource validation.
Error: Execution Exception (state: ValidateAzureResource) (step: Invocation)
Error:   When request Azure resource at ValidateAzureResource, Get Function App Settings : Failed to acquire app settings from https://<scmsite>/api/settings with publish-profile
Error:     Failed to fetch Kudu App Settings.
Site Unavailable from Mini-ARR (CODE: 503)
Error:       Error: Failed to fetch Kudu App Settings.
Site Unavailable from Mini-ARR (CODE: 503)
    at Kudu.<anonymous> (/home/runner/work/_actions/Azure/functions-action/v1/node_modules/azure-actions-appservice-rest/Kudu/azure-app-kudu-service.js:62:23)
    at Generator.next (<anonymous>)
    at fulfilled (/home/runner/work/_actions/Azure/functions-action/v1/node_modules/azure-actions-appservice-rest/Kudu/azure-app-kudu-service.js:5:58)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
Error: Deployment Failed!

The function app is hosted on Windows and runs NodeJS 14. This workflow has been working without issues for the last year.

EDIT: This was due to the unavailability of my app. After making sure app was working as expected (storage link, CPU usage, Outbound TCP connexions). I can deploy as usual

github-actions[bot] commented 2 years ago

This issue is idle because it has been open for 14 days with no activity.

Crisfole commented 1 year ago

@patelchandni Outstanding news! What's the solution if it's completed?