Reputation: 331
I have 1 function app that for some reason doesn't want to deploy (All 30 other function apps I manage deploy fine with the same ZipDeploy method).
After running the following AzureCLI command to deploy to an existing consumption based function app:
az functionapp deployment source config-zip --resource-group $resourceGroupName --name $functionAppName --src $artifactPath
This returns a successful deployment result (see bottom of question for the full JSON result), however looking in the Functions blade for the function app, this is empty:
My question is this - what am i doing wrong here? Why does deploying a function via AzureCLI fail?
A bit of background:
Things i've tried so far:
Full logging from the AzureCLI command: Setting SCM_DO_BUILD_DURING_DEPLOYMENT to false Waiting SCM site to be updated with the latest app settings Getting scm site credentials for zip deployment Starting zip deployment. This operation can take a while to complete ... Deployment endpoint responded with status code 202
Full JSON response from the AzureCLI command:
active : True
author : N/A
author_email : N/A
complete : True
deployer : ZipDeploy
end_time : 23/09/2020 16:32:28
id : 02c6219516244615beca1c126749baa1
is_readonly : True
is_temp : False
last_success_end_time : 23/09/2020 16:32:28
log_url : https://xxxx.scm.azurewebsites.net/api/deployments/latest/log
message : Created via a push deployment
progress :
provisioningState :
received_time : 23/09/2020 16:31:55
site_name : xxxx
start_time : 23/09/2020 16:31:55
status : 4
status_text :
url : https://xxxx.scm.azurewebsites.net/api/deployments/latest
EDIT 1: Here are the contents of the wwwroot folder for anyone interested - they follow the same structure as other functions we have (which deploy fine and display in the Functions view in the portal):
Upvotes: 2
Views: 2833
Reputation: 331
After long last we found out the cause of why the function app didn't deploy.
Turns out it deployed fine (the files were deployed in the right place) - it's just that the function runtime crashed on startup.
We found the usage of 'builder.Services.AddMvc()' caused this issue:
Which makes sense, given Azure Functions aren't Mvc. Derp!
We removed this line and voila, no more issues.
Upvotes: 2
Reputation: 3398
I might know what's wrong during your ZipDeploy process. Maybe the way you get your zip folder is wrong.
As I said, you can check if the destiny function app name is correct, and check if the content in https://<functionAppName>.scm.azurewebsites.net/DebugConsole -->site-->wwwroot(kudu) is correct.
The correct step of ZipDepoly is:
1. Click Publish option just like deployed via the 'Publish' route in Visual Studio 2019
2. Choose folder to create publish file.
3. Compress the publish file content you got from last step. The structure of publish file is same as in docs.
Publish.zip | - bin | - host.json | - FunctionName | | - function.json
4. Publish that zip file by your command. And the content of wwwroot should be same as publish file:
Upvotes: 1