Azure / Azure-Functions

1.12k stars 199 forks source link

Azure Function ZipDeploy failed with HTTP status code RequestTimeout. #1403

Open nogginbox opened 5 years ago

nogginbox commented 5 years ago

I am trying to deploy my Azure function using ZipDeploy. This was working till I added an extra Nuget package and the size of my function's deployment zip package increased from 3MB to 45MB.

I now get:

2>Publishing C:\Users\...\obj\Release\netcoreapp3.0\PubTmp\Fuction - 20191118172050631.zip to https://xxxx.scm.azurewebsites.net/api/zipdeploy...
2>The attempt to publish the ZIP file through https://xxxx.scm.azurewebsites.net/api/zipdeploy failed with HTTP status code RequestTimeout.

If I login to Kudu at https://{xxxx}.scm.azurewebsites.net/ (replacing xxxx with website name), download the diagnostic dump and look in the folder LogFiles\kudu\trace I can see the following error:

<step title="Incoming Request" date="2019-11-18T17:21:31.617" instance="77ee76" url="/api/zipdeploy" method="POST" type="request" pid="16924,2,6" Connection="Keep-Alive" Content-Length="46241155" Content-Type="application/zip; charset=utf-8" Content-Encoding="utf-8" Authorization="Bas..." Host="xxxx.scm.azurewebsites.net" User-Agent="functions-core-tools/1.0.29_VisualStudio_16.0" X-WAWS-Unencoded-URL="/api/zipdeploy" CLIENT-IP="212.250.23.76:37891" X-ARR-LOG-ID="a8cf1bc2-eac8-43c4-acfb-f5c1f7a4c3f9" X-SITE-DEPLOYMENT-ID="HtmlToPdfSpike" WAS-DEFAULT-HOSTNAME="xxxx.scm.azurewebsites.net" X-Forwarded-Proto="https" X-AppService-Proto="https" >
  <step title="ZipPushDeploy" date="2019-11-18T17:21:32.073" >
    <step title="Saving request content to D:\home\data\SitePackages\20191118172132.zip" date="2019-11-18T17:21:32.212" >
      <step title="Writing 2,232,320 bytes to D:\home\data\SitePackages\20191118172132.zip" date="2019-11-18T17:22:02.418" /><!-- duration: 125ms -->
      <step title="Writing 4,284,416 bytes to D:\home\data\SitePackages\20191118172132.zip" date="2019-11-18T17:22:32.666" /><!-- duration: 364ms -->
      <step title="Writing 6,344,704 bytes to D:\home\data\SitePackages\20191118172132.zip" date="2019-11-18T17:23:03.405" /><!-- duration: 109ms -->
    </step><!-- duration: 96990ms -->
  </step><!-- duration: 97191ms -->
  <step title="Error occurred" date="2019-11-18T17:23:09.390" type="error" text="The client disconnected." stackTrace="   at System.Web.Hosting.IIS7WorkerRequest.EndRead(IAsyncResult asyncResult)
   at System.Web.HttpBufferlessInputStream.EndRead(IAsyncResult asyncResult)
   at System.IO.Stream.&lt;&gt;c.&lt;BeginEndReadAsync&gt;b__43_1(Stream stream, IAsyncResult asyncResult)
   at System.Threading.Tasks.TaskFactory`1.FromAsyncTrimPromise`1.Complete(TInstance thisRef, Func`3 endMethod, IAsyncResult asyncResult, Boolean requiresSynchronization)
--- End of stack trace from previous location where exception was thrown ---
   ........" /><!-- duration: 78ms -->
  <step title="Outgoing response" date="2019-11-18T17:23:09.718" type="response" statusCode="500" statusText="Internal Server Error" Server="Microsoft-IIS/10.0" x-ms-request-id="a8cf1bc2-eac8-43c4-acfb-f5c1f7a4c3f9" Cache-Control="private" X-AspNet-Version="4.0.30319" Content-Type="application/json; charset=utf-8" /><!-- duration: 156ms -->
</step><!-- duration: 98397ms -->

The key bit seems to be The client disconnected.

I followed the advice in issue #1108 of setting WEBSITE_RUN_FROM_PACKAGE to 0, but this did not resolve the issue. This happens every time I try to deploy (tried on several networks, home and office) and the kudu logs show it is happening at the same place.

nogginbox commented 5 years ago

As a workaround I've been able to deploy my function using FTP.

Took me a while to find the FTP details. They're in the publish profile that you can download from the function's homepage in the azure Portal with the 'Get publish profile' link. This has two profiles in the same file and the second one has all the FTP details you need.

nogginbox commented 5 years ago

Also found dragging and dropping zip files into Kudu Console file explorer works, but FTP works slightly better.

jjxtra commented 4 years ago

What do you need to zip up? Just the bin/release/netcoreapp3.1 folder?

jjxtra commented 4 years ago

Posting my solution here in case anyone runs into the same issue, it is a second answer to the question.

https://stackoverflow.com/questions/53103896/azure-function-publishing-failed-requesttimeout/59339511#59339511