Gopal
Gopal

Reputation: 51

How to fix error in function app publish through visual studio

I am running into problem when I try to publish the Azure function app from visual studio to Azure.

I picked a sample function from the predefined examples. It works well when I run the project locally in studio and I can invoke it thr' browser.

However, When I publish it using zip deployment through Studio, it always fails with below error:

1>------ Build started: Project: FunctionApp1, Configuration: Release Any CPU ------ 1>FunctionApp1 -> C:\Users\<>\source\repos\FunctionApp1\bin\Release\netcoreapp2.1\bin\FunctionApp1.dll 2>------ Publish started: Project: FunctionApp1, Configuration: Release Any CPU ------ 2>FunctionApp1 -> C:\Users\<>\source\repos\FunctionApp1\bin\Release\netcoreapp2.1\bin\FunctionApp1.dll 2>FunctionApp1 -> C:\Users\<>\source\repos\FunctionApp1\obj\Release\netcoreapp2.1\PubTmp\Out\ 2>Publishing C:\Users\<>\source\repos\FunctionApp1\obj\Release\netcoreapp2.1\PubTmp\FunctionApp1 - 20190430110751931.zip to https://functionapp120190430104807.scm.azurewebsites.net/api/zipdeploy... 2>The attempt to publish the ZIP file through https://functionapp120190430104807.scm.azurewebsites.net/api/zipdeploy failed with HTTP status code RequestTimeout. ========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ========== ========== Publish: 0 succeeded, 1 failed, 0 skipped ==========

What can I do to resolve this? I am a beginner in Azure, so please excuse me for any obvious thing missed.

Thanks !!

Upvotes: 3

Views: 4308

Answers (4)

Larry Smith
Larry Smith

Reputation: 1973

If there's anything that errors out on app restart during the deployment, your deployment will fail.

Double-check your configuration blade. I recently ran into this stubborn, inscrutable error while trying to deploy to a staging slot. The production slot worked but not staging.

Then I discovered that I had missed one of the configuration settings on the staging slot. Once that was applied I could then zip-deploy successfully to either slot.

Upvotes: 0

Holy semicolon
Holy semicolon

Reputation: 1389

I faced the same problem when I tried to deploy a function to azure function linux through visual studio code, I got this error:

No route registered for '/api/zipdeploy'

enter image description here

enter image description here

To solve this problem all you need is to add a new application setting WEBSITE_RUN_FROM_PACKAGE and set it to true 1, to your existing function app in the azure portal like the following:

enter image description here

then the deployment will hopefully work

enter image description here

#EDIT

I tried to create a new function app on azure using visual studio azure function extension, and didn't add that app setting, and the function code got deployed successfully.

Upvotes: 0

Navid Ahrary
Navid Ahrary

Reputation: 13

I installed the azure-cli package with pip and the issue resolved. The issue may come from the broken azure-cli dependencies.

Upvotes: 0

Joey Cai
Joey Cai

Reputation: 20127

Zip deployment is a feature of Azure App Service that lets you deploy your function app project to the wwwroot directory. The project is packaged as a .zip deployment file. The same APIs can be used to deploy your package to the d:\home\data\SitePackages folder.

Set WEBSITE_RUN_FROM_PACKAGE to 0 and restart azure function then it will work fine.

Upvotes: 1

Related Questions