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

zip deploy 400 error due to Central Directory corrupt. #252

Open
georgeOsdDev opened this issue Apr 6, 2022 · 0 comments
Open

zip deploy 400 error due to Central Directory corrupt. #252

georgeOsdDev opened this issue Apr 6, 2022 · 0 comments

Comments

@georgeOsdDev
Copy link

georgeOsdDev commented Apr 6, 2022

Problem

zip deploy using /api/publish?type=zip by curl described below document result 400 error.
https://docs.microsoft.com/en-us/azure/app-service/deploy-zip?tabs=api#deploy-a-zip-package

Repro Step:

curl -X POST -u <deployment_user> --data-binary @"<zip_file_path>" https://<app_name>.scm.azurewebsites.net/api/publish?type=zip

Environment:

1.0.0.7 (e59ed50ca2)

Log:

> POST /api/publish?type=zip HTTP/1.1
> Host: testkuduzipdeoloy.scm.azurewebsites.net
> Authorization: Basic JHRlc■■■■==
> User-Agent: curl/7.68.0
> Accept: */*
> Content-Length: 740895
> Content-Type: application/x-www-form-urlencoded
> Expect: 100-continue
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 100 Continue
* We are completely uploaded and fine
* Mark bundle as not supporting multiuse
< HTTP/1.1 400 Bad Request
< Cache-Control: no-cache
< Pragma: no-cache
< Expires: -1
< Server: Kestrel
< Set-Cookie: ARRAffinity=bc73405f088a481bce9031c7b1fcb03c60435387299bbfcd3c3234768c74f51e;Path=/;HttpOnly;Secure;Domain=testkuduzipdeoloy.scm.azurewebsites.net
< Set-Cookie: ARRAffinitySameSite=bc73405f088a481bce9031c7b1fcb03c60435387299bbfcd3c3234768c74f51e;Path=/;HttpOnly;SameSite=None;Secure;Domain=testkuduzipdeoloy.scm.azurewebsites.net
< Date: Wed, 06 Apr 2022 08:57:41 GMT
< Content-Length: 0
<
<step title="Incoming Request" date="2022-04-06T08:57:39.426" instance="bc7340" url="/api/publish?type=zip" method="POST" type="request" pid="69,1,14" Connection="Keep-Alive" Content-Type="application/x-www-form-urlencoded" Accept="*/*" Authorization="Bas..." Host="testkuduzipdeoloy.scm.azurewebsites.net" User-Agent="curl/7.68.0" Content-Length="740895" X-Client-IP="■■■■" X-Client-Port="51050" X-WAWS-Unencoded-URL="/api/publish?type=zip" CLIENT-IP=■■■■" X-ARR-LOG-ID="9f5ad4eb-4cde-4a7a-8003-73f39db5bb33" X-SITE-DEPLOYMENT-ID="testkuduzipdeoloy" WAS-DEFAULT-HOSTNAME="testkuduzipdeoloy.scm.azurewebsites.net" X-Forwarded-Proto="https" X-AppService-Proto="https" X-Forwarded-TlsVersion="1.2" >
  <step title="Cleanup Xml Logs" date="2022-04-06T08:57:39.438" /><!-- duration: 27ms -->
  <step title="OneDeploy" date="2022-04-06T08:57:39.900" >
    <step title="Writing artifact to /tmp/zipdeploy/285426db-640c-4503-ae9a-a88964f10d19.zip" date="2022-04-06T08:57:39.971" /><!-- duration: 11ms -->
    <step title="Attempting to fetch target branch HEAD" date="2022-04-06T08:57:39.996" /><!-- duration: 13ms -->
    <step title="Acquiring Deployment Lock" date="2022-04-06T08:57:40.023" /><!-- duration: 10ms -->
    <step title="Acquired Deployment Lock" date="2022-04-06T08:57:40.111" /><!-- duration: 12ms -->
    <step title="Performing fetch based deployment" date="2022-04-06T08:57:40.150" >
      <step title="Creating temporary deployment" date="2022-04-06T08:57:40.161" /><!-- duration: 217ms -->
      <step title="Cleaning up temp folders from previous zip deployments and extracting pushed zip file /tmp/zipdeploy/285426db-640c-4503-ae9a-a88964f10d19.zip (0.00 MB) to /tmp/zipdeploy/extracted" date="2022-04-06T08:57:41.655" /><!-- duration: 21ms -->
      <step title="Marking deployment as failed" date="2022-04-06T08:57:41.735" /><!-- duration: 7ms -->
    </step><!-- duration: 1624ms -->
    <step title="Releasing Deployment Lock" date="2022-04-06T08:57:41.782" /><!-- duration: 5ms -->
  </step><!-- duration: 1916ms -->
  <step title="Error occurred" date="2022-04-06T08:57:41.862" type="error" text="Central Directory corrupt." stackTrace="   at System.IO.Compression.ZipArchive.ReadEndOfCentralDirectory()
   at System.IO.Compression.ZipArchive.Init(Stream stream, ZipArchiveMode mode, Boolean leaveOpen)
   at System.IO.Compression.ZipArchive..ctor(Stream stream, ZipArchiveMode mode)
   at Kudu.Services.Deployment.PushDeploymentController.LocalZipFetch(IRepository repository, DeploymentInfoBase deploymentInfo, String targetBranch, ILogger logger, ITracer tracer)
   at Kudu.Services.Deployment.PushDeploymentController.LocalZipHandler(IRepository repository, DeploymentInfoBase deploymentInfo, String targetBranch, ILogger logger, ITracer tracer)
   at Kudu.Core.Deployment.FetchDeploymentManager.PerformDeployment(DeploymentInfoBase deploymentInfo, IDisposable tempDeployment, ChangeSet tempChangeSet)
   at Kudu.Core.Deployment.FetchDeploymentManager.PerformDeployment(DeploymentInfoBase deploymentInfo, IDisposable tempDeployment, ChangeSet tempChangeSet)
   at Kudu.Core.Deployment.FetchDeploymentManager.&lt;&gt;c__DisplayClass9_0.&lt;&lt;FetchDeploy&gt;b__0&gt;d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Kudu.Core.Deployment.FetchDeploymentManager.FetchDeploy(DeploymentInfoBase deployInfo, Boolean asyncRequested, Uri requestUri, String targetBranch)
   at Kudu.Services.Deployment.PushDeploymentController.PushDeployAsync(ArtifactDeploymentInfo deploymentInfo, Boolean isAsync, HttpContext context, JObject requestJson)
   at Kudu.Services.Deployment.PushDeploymentController.OneDeploy(String type, Boolean async, String path, Nullable`1 restart, Nullable`1 clean, Boolean ignoreStack, Boolean trackDeploymentProgress)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.&lt;InvokeActionMethodAsync&gt;g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.&lt;InvokeNextActionFilterAsync&gt;g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State&amp; next, Scope&amp; scope, Object&amp; state, Boolean&amp; isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.&lt;InvokeNextResourceFilter&gt;g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State&amp; next, Scope&amp; scope, Object&amp; state, Boolean&amp; isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.&lt;InvokeAsync&gt;g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
   at Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)
   at Microsoft.AspNetCore.Builder.Extensions.MapMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Builder.Extensions.MapMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Builder.Extensions.MapMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Builder.Extensions.MapMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Builder.Extensions.MapMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Builder.Extensions.MapMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Builder.Extensions.MapMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Builder.Extensions.MapMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Builder.Extensions.MapMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Builder.Extensions.MapMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Builder.Extensions.MapMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Builder.Extensions.MapMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Builder.Extensions.MapMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Builder.Extensions.MapWhenMiddleware.Invoke(HttpContext context)
   at Kudu.Services.Web.Tracing.TraceMiddleware.Invoke(HttpContext context)" innerText="Invalid argument" innerStackTrace="   at System.IO.FileStream.CheckFileCall(Int64 result, Boolean ignoreNotSupported)
   at System.IO.FileStream.Seek(Int64 offset, SeekOrigin origin)
   at System.IO.Compression.ZipArchive.ReadEndOfCentralDirectory()" /><!-- duration: 37ms -->
  <step title="Incoming Request" date="2022-04-06T08:57:41.925" url="/Error?type=zip" method="POST" type="request" pid="69,1,16" Connection="Keep-Alive" Content-Type="application/x-www-form-urlencoded" Accept="*/*" Authorization="Bas..." Host="testkuduzipdeoloy.scm.azurewebsites.net" User-Agent="curl/7.68.0" Content-Length="740895" X-Client-IP="■■■■" X-Client-Port="51050" X-WAWS-Unencoded-URL="/api/publish?type=zip" CLIENT-IP="■■■■" X-ARR-LOG-ID="9f5ad4eb-4cde-4a7a-8003-73f39db5bb33" X-SITE-DEPLOYMENT-ID="testkuduzipdeoloy" WAS-DEFAULT-HOSTNAME="testkuduzipdeoloy.scm.azurewebsites.net" X-Forwarded-Proto="https" X-AppService-Proto="https" X-Forwarded-TlsVersion="1.2" >
    <step title="Outgoing response" date="2022-04-06T08:57:41.970" type="response" statusCode="400" statusText="BadRequest" /><!-- duration: 12ms -->
  </step><!-- duration: 79ms -->

Misc

  • This error occur on only Linux(Kudulite). On Windows, same command with same module successfully deploy.
  • When I use /api/zipDeoloy with same module, it successfully deploy.
  • When I remove Content-Type request header with -H "Content-Type:" option, it successfully deploy.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant