Azure / functions-action

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

Flex Consumption deployment (Node Azure Functions App) #238

Open miszu opened 2 months ago

miszu commented 2 months ago

I see that this PR by @patelchandni https://github.com/Azure/functions-action/pull/229 adds support for Flex Consumption plan of Azure Functions. I've tried deploying my Node Azure Function app to Flex Consumption with this yml actio:

    - name: 'Run Azure Functions Action'
      uses: Azure/functions-action@v1.5.2
      id: fa
      with:
        app-name: ${{ env.AZURE_FUNCTIONAPP_NAME }}
        package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}
        publish-profile: ${{ secrets.AZURE_FUNCTIONAPP_PUBLISH_PROFILE }}
        sku: flexconsumption
        remote-build: true

but this fails with:

Run Azure/functions-action@v1.5.2
  with:
    app-name: fitfunctionsapi
    package: .
    publish-profile: ***
    sku: flexconsumption
    remote-build: true
    respect-pom-xml: false
    respect-funcignore: false
    scm-do-build-during-deployment: false
    enable-oryx-build: false
  env:
    AZURE_FUNCTIONAPP_NAME: fitfunctionsapi
    AZURE_FUNCTIONAPP_PACKAGE_PATH: .
Successfully parsed SCM credential from publish-profile format.
Using SCM credential for authentication, GitHub Action will not perform resource validation.
Successfully acquired app settings from function app (with SCM credential)!
Will archive . into /home/runner/work/_temp/temp_web_package_3544899524961187.zip as function app content
Will use Kudu https://<scmsite>/api/publish to deploy since Flex consumption plan is detected.
Will use parameter remote-build: true
Package deployment using One Deploy initiated.
Starting deployment pipeline.
[ValidationStep] starting.
[AppSettingValidation] starting.
[DeploymentStorageValidation] starting.
Validation completed
[SourcePackageUriDownloadStep] starting.
Zip package is present at /tmp/zipdeploy/787287ed-8789-40f4-9f05-f9e150f41c70.zip
[ExtractZipStep] starting.
Cleaning files in /tmp/zipdeploy/extracted
Extracted zip package in /tmp/zipdeploy/extracted
[OryxBuildStep] starting.
Running oryx build command: oryx build /tmp/zipdeploy/extracted -o /home/site/wwwroot --platform nodejs --platform-version 20.11.1
sh: 1: tsc: Permission denied
sh: 1: tsc: Permission denied\n/opt/Kudu/Scripts/starter.sh oryx build /tmp/zipdeploy/extracted -o /home/site/wwwroot --platform nodejs --platform-version 20.11.1
Failed during oryx build due to sh: 1: tsc: Permission denied\n/opt/Kudu/Scripts/starter.sh oryx build /tmp/zipdeploy/extracted -o /home/site/wwwroot --platform nodejs --platform-version 20.11.1
Deployment failed with Error: sh: 1: tsc: Permission denied\n/opt/Kudu/Scripts/starter.sh oryx build /tmp/zipdeploy/extracted -o /home/site/wwwroot --platform nodejs --platform-version 20.11.1
Error: Failed to deploy web package to Function App.
Error: Execution Exception (state: PublishContent) (step: Invocation)
Error:   When request Azure resource at PublishContent, oneDeploy : Failed to use /home/runner/work/_temp/temp_web_package_3544899524961187.zip as OneDeploy content
Error:     Package deployment using ZIP Deploy failed. Refer logs for more details.
Error: Deployment Failed!

Am I doing something wrong? I'd appreciate any help and would be happy to provide more logs/test solutions :)

Yvand commented 2 months ago

I am experiencing exactly the same error, with exactly the same settings in the action. @miszu did you find a solution?

miszu commented 2 months ago

I am experiencing exactly the same error, with exactly the same settings in the action. @miszu did you find a solution?

@Yvand unfortunately I did not find a solution and gave up for the time being :(

Yvand commented 2 months ago

I checked the deplyment logs on the app service side, and it looks like a dumb warning on a deprecated package causes the failure:

[ // removed irrelevant content
    {
        "log_time": "2024-07-02T13:08:44.7964544Z",
        "id": "335bd5f8-5624-4bf9-823c-5b500503e551",
        "message": "npm WARN deprecated debug@4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)\\nnpm notice \\nnpm notice New minor version of npm available! 10.2.4 -> 10.8.1\\nnpm notice Changelog: <https://github.com/npm/cli/releases/tag/v10.8.1>\\nnpm notice Run `npm install -g npm@10.8.1` to update!\\nnpm notice\\n/opt/Kudu/Scripts/starter.sh oryx build /tmp/zipdeploy/extracted -o /home/site/wwwroot --platform nodejs --platform-version 20.11.1",
        "type": 2
    },
    {
        "log_time": "2024-07-02T13:08:44.7968642Z",
        "id": "335bd5f8-5624-4bf9-823c-5b500503e551",
        "message": "Failed during oryx build due to npm WARN deprecated debug@4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)\\nnpm notice \\nnpm notice New minor version of npm available! 10.2.4 -> 10.8.1\\nnpm notice Changelog: <https://github.com/npm/cli/releases/tag/v10.8.1>\\nnpm notice Run `npm install -g npm@10.8.1` to update!\\nnpm notice\\n/opt/Kudu/Scripts/starter.sh oryx build /tmp/zipdeploy/extracted -o /home/site/wwwroot --platform nodejs --platform-version 20.11.1",
        "type": 2
    },
    {
        "log_time": "2024-07-02T13:08:44.8228944Z",
        "id": "335bd5f8-5624-4bf9-823c-5b500503e551",
        "message": "Deployment failed with Error: npm WARN deprecated debug@4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)\\nnpm notice \\nnpm notice New minor version of npm available! 10.2.4 -> 10.8.1\\nnpm notice Changelog: <https://github.com/npm/cli/releases/tag/v10.8.1>\\nnpm notice Run `npm install -g npm@10.8.1` to update!\\nnpm notice\\n/opt/Kudu/Scripts/starter.sh oryx build /tmp/zipdeploy/extracted -o /home/site/wwwroot --platform nodejs --platform-version 20.11.1",
        "type": 2
    }
]
patelchandni commented 2 months ago

@miszu and @Yvand - The error occurs during oryx build so, it is not an issue with this GitHub action but some dependency in your package itself is deprecated and so oryx build is failing. Please correct the version is your app.

Yvand commented 2 months ago

You are totally right, I can repro the same warning message on my machine if I delete folder node_modules and then run npm install. Based on the package-lock.json, it is @azure/cosmos 4.0.0 that explicitly depends on debug 4.1.1, hence causing the warning message.

Thank you for your very useful input!