Running Azure/functions-container-action@v1 github actions - TypeError: Cannot read property 'getApplicationURL'

I have an azure function (python code) containerized in a Dockerfile. I want to run it from Github actions, so I am doing in my workflow the following:


    - name: 'Run Azure Functions Container Action'
      uses: Azure/functions-container-action@v1
      id: fa
      with:
        app-name: my-spec-prod-azure-function
        image: containerregistry.azurecr.io/my-azure-function:latest

    - name: Azure logout
      run: |
        az logout

The thing here is I am using Azure/functions-container-action@v1 github action to run the container but it does not work, I got the following message error in my pipeline:

Run Azure/functions-container-action@v1
  with:
    app-name: my-spec-prod-azure-function
    image: containerregistry.azurecr.io/my-azure-function:latest
  env:
    AZURE_HTTP_USER_AGENT: 
    AZUREPS_HOST_ENVIRONMENT: 
    DOCKER_CONFIG: /home/runner/work/_temp/docker_login_1613723968334
Error: Error: Resource my-spec-prod-azure-function doesn't exist.
(node:4655) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'getApplicationURL' of undefined
    at /home/runner/work/_actions/Azure/functions-container-action/v1/lib/main.js:68:68
    at Generator.throw (<anonymous>)
    at rejected (/home/runner/work/_actions/Azure/functions-container-action/v1/lib/main.js:6:65)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:4655) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:4655) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Checking the azure actions workflow samples, you also use the same action (Azure/functions-container-action@v1) to deploy an azure function, they emphasize that here.

Here someone got a similar error description but I am afraid it is not for azure functions container but for appservices actions that use containers. Despite that, I also tried the azure/webapps-container-deploy@v1 action but it does not work, and I think that is not a suited action.

I checked your official marketplace site and you say this is the latest version to use:

- name: Azure Functions Container Action
  uses: Azure/functions-container-action@v1.0.1

So I changed Azure/functions-container-action@v1 by Azure/functions-container-action@v1.0.1
without success, I got a very similar error but with some hints or clue about setting environment variables.

Error: Unable to process command '::set-env name=AZURE_HTTP_USER_AGENT,::GITHUBACTIONS_DeployFunctionAppContainerToAzure_b32b908e01efeb4da360da24648fd5091bc18dcc93090b9c05ee3b76efe9b57e' successfully.
Error: The `set-env` command is disabled. Please upgrade to using Environment Files or opt into unsecure command execution by setting the `ACTIONS_ALLOW_UNSECURE_COMMANDS` environment variable to `true`. For more information see: github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands
Error: Error: Resource my-spec-prod-azure-function doesn't exist.
(node:4508) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'getApplicationURL' of undefined
    at /home/runner/work/_actions/Azure/functions-container-action/v1.0.1/lib/main.js:68:68
    at Generator.throw (<anonymous>)
    at rejected (/home/runner/work/_actions/Azure/functions-container-action/v1.0.1/lib/main.js:6:65)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:4508) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:4508) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Regarding the The set-env command is disabled new error message, checking the log changes, here is not clear for me how or why the env variables like AZURE_HTTP_USER_AGENT and the other one should be set it up properly.
I am reading this question, but actually checking it

You should file an issue on the repo for the Action as they are going to be the best ones to resolve it.

1 Like