Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

func azure functionapp publish needs to be executed twice for it to work properly. #4140

Open
azarboon opened this issue Nov 1, 2024 · 7 comments

Comments

@azarboon
Copy link

azarboon commented Nov 1, 2024

Version

4.0.6543

Description

I've to execute func azure functionapp publish twice to make it work. The first time, it said following but didn't provide any invoke URL.

Upload completed successfully.
Deployment completed successfully.
Functions in myFunctionName:

Then, I immediately executed func azure functionapp publish for second time and I got an actual invoke url:

Getting site publishing info...
[2024-11-01T06:32:18.712Z] Starting the function app deployment...
Creating archive for current directory...
Uploading 633,74 KB [#########################################################################]
Upload completed successfully.
Deployment completed successfully.
Functions in myFunctionName:
    FuncFromCli - [httpTrigger]
        Invoke url: https://efzzgfjrmefcw.azurewebsites.net/api/funcfromcli

Steps to reproduce

Created a function using Terraform v1.9.7 and and AzureRM provider v4.6.0 with following settings:

resource "azurerm_linux_function_app" "example" {
  name                       = random_string.random_name.result
  resource_group_name        = data.azurerm_resource_group.rg.name
  location                   = data.azurerm_resource_group.rg.location
  service_plan_id            = azurerm_service_plan.example.id

  storage_account_name       = azurerm_storage_account.example.name
  storage_account_access_key = azurerm_storage_account.example.primary_access_key

  site_config {
    application_stack {
      node_version = "20"
    }
  }
}

After successful deployment from Terraform, I went to my function's code folder and ran this func azure functionapp publish myFunctionName

@ashikns
Copy link

ashikns commented Nov 1, 2024

I'm also facing issues with version 6543. It is marked as preview on github, but tagged latest on npm; and VS Code extension asks to update to it. Please stop marking pre release versions as latest.

@liliankasem
Copy link
Member

Hi @azarboon - I attempted to repro the issue and was not able to, the publish command worked for me on the first attempt

Getting site publishing info...
[2024-11-08T19:23:41.241Z] Starting the function app deployment...
Uploading package...
Uploading 1.74 MB [###############################################################################]
Upload completed successfully.
Deployment completed successfully.
[2024-11-08T19:23:52.412Z] Syncing triggers...
Functions in reproapp:
    httpTrigger - [httpTrigger]
        Invoke url: https://<myapp>.azurewebsites.net/api/httptrigger

Could it have just been a timing issue? Maybe with the terraform deployment you needed another minute before the app was ready in azure to publish the func app? Could you try this again or maybe provide a GH repository with a full repro example for me to try out?

No changes were made to publish in v4.0.6543 so I wonder if the issue is related to something else.


@ashikns - 6543 is the latest, stable version and not just a prerelease. It should have been updated in GH and wasn't (we have done so now).

If you are experiencing issues with v4.0.6543 not related to publish, please open a new GH issue so we can investigate accordingly.

@azarboon
Copy link
Author

azarboon commented Nov 9, 2024

Hi @azarboon - I attempted to repro the issue and was not able to, the publish command worked for me on the first attempt

Getting site publishing info...
[2024-11-08T19:23:41.241Z] Starting the function app deployment...
Uploading package...
Uploading 1.74 MB [###############################################################################]
Upload completed successfully.
Deployment completed successfully.
[2024-11-08T19:23:52.412Z] Syncing triggers...
Functions in reproapp:
    httpTrigger - [httpTrigger]
        Invoke url: https://<myapp>.azurewebsites.net/api/httptrigger

Could it have just been a timing issue? Maybe with the terraform deployment you needed another minute before the app was ready in azure to publish the func app? Could you try this again or maybe provide a GH repository with a full repro example for me to try out?

No changes were made to publish in v4.0.6543 so I wonder if the issue is related to something else.

@ashikns - 6543 is the latest, stable version and not just a prerelease. It should have been updated in GH and wasn't (we have done so now).

If you are experiencing issues with v4.0.6543 not related to publish, please open a new GH issue so we can investigate accordingly.

Thanks for reply. I encounter this issue almost every day. Below is my Azure Functions configs in Terraform:

resource "azurerm_storage_account" "example" {
  name                     = random_string.random_name.result
  resource_group_name      = data.azurerm_resource_group.rg.name
  location                 = data.azurerm_resource_group.rg.location
  account_tier             = "Standard"
  account_replication_type = "LRS"

}

resource "azurerm_service_plan" "example" {
  name                = "example-app-service-plan"
  resource_group_name = data.azurerm_resource_group.rg.name
  location            = data.azurerm_resource_group.rg.location
  os_type             = "Linux"
  sku_name            = "B1"

}

resource "azurerm_linux_function_app" "example" {
  name                       = "myfuncapp${random_string.random_name.result}"
  resource_group_name        = data.azurerm_resource_group.rg.name
  location                   = data.azurerm_resource_group.rg.location
  service_plan_id            = azurerm_service_plan.example.id

  storage_account_name       = azurerm_storage_account.example.name
  storage_account_access_key = azurerm_storage_account.example.primary_access_key
  site_config {

    application_stack {
      node_version = "20"

    }
  }
}

Here is my function code which is a basic HTTP triggered Node.js function:

const { app } = require('@azure/functions');

app.http('FuncFromCli', {
    methods: ['GET', 'POST'],
    authLevel: 'anonymous',
    handler: async (request, context) => {
        context.log(`Http function processed request for url "${request.url}"`);

        const name = request.query.get('name') || await request.text() || 'world';

        return { body: `Updated Hello, ${name}!` };
    }
});

@ashikns
Copy link

ashikns commented Nov 9, 2024

@liliankasem I am facing the issue mentioned in the first post. Occasionally a function publish doesn't seem to do anything and I have to publish again. Because of this I now have to wait ~10 mins or so for the deployment on cloud to happen, then check if the files have updated. Sometimes it just doesn't. And to confirm the theory in one of those instances I did wait up to half a day to confirm deployment was not just delayed by some minutes.

I don't know if something simultaneously changed in Azure side and this is just maybe nothing to do with function tools. But I am facing this issue yes, not a different issue. For reference it is a python function running on consumption plan.

@azarboon
Copy link
Author

azarboon commented Nov 9, 2024

@liliankasem I am facing the issue mentioned in the first post. Occasionally a function publish doesn't seem to do anything and I have to publish again. Because of this I now have to wait ~10 mins or so for the deployment on cloud to happen, then check if the files have updated. Sometimes it just doesn't. And to confirm the theory in one of those instances I did wait up to half a day to confirm deployment was not just delayed by some minutes.

I don't know if something simultaneously changed in Azure side and this is just maybe nothing to do with function tools. But I am facing this issue yes, not a different issue. For reference it is a python function running on consumption plan.

Similar to me. Few days ago, I deployed the function a few times but still the func cli didnt show invoke url. However, I could invoke the function if I already obtained the invoke url from other place. It's just buggy.

@azarboon
Copy link
Author

azarboon commented Nov 9, 2024

@liliankasem I am facing the issue mentioned in the first post. Occasionally a function publish doesn't seem to do anything and I have to publish again. Because of this I now have to wait ~10 mins or so for the deployment on cloud to happen, then check if the files have updated. Sometimes it just doesn't. And to confirm the theory in one of those instances I did wait up to half a day to confirm deployment was not just delayed by some minutes.
I don't know if something simultaneously changed in Azure side and this is just maybe nothing to do with function tools. But I am facing this issue yes, not a different issue. For reference it is a python function running on consumption plan.

Similar to me. Few days ago, I deployed the function a few times but still the func cli didnt show invoke url. However, I could invoke the function if I already obtained the invoke url from other place. It's just buggy.

To add, I have a very basic HTTP triggered Node.js based function.

@liliankasem
Copy link
Member

@liliankasem I am facing the issue mentioned in the first post. Occasionally a function publish doesn't seem to do anything and I have to publish again. Because of this I now have to wait ~10 mins or so for the deployment on cloud to happen, then check if the files have updated. Sometimes it just doesn't. And to confirm the theory in one of those instances I did wait up to half a day to confirm deployment was not just delayed by some minutes.

I don't know if something simultaneously changed in Azure side and this is just maybe nothing to do with function tools. But I am facing this issue yes, not a different issue. For reference it is a python function running on consumption plan.

Is your resource deployment also via terraform like the original post? Or via different approach?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants