title: AWS ElastikBeanstak: Error: staging application failed due to invalid zip file
body: <p>I tried to deploy a docker for a web app but my environment creation and web-app deployment failed.</p>
  <p>All the code that you see bellow is coming from the <code>eb-engine.log</code>:</p>
  <pre><code>----------------------------------------
  /var/log/eb-engine.log
  ----------------------------------------
  2021/11/22 14:15:51.981546 [INFO] Executing instruction: TuneSystemSettings
  2021/11/22 14:15:51.981549 [INFO] Starting TuneSystemSettings
  2021/11/22 14:15:51.981554 [INFO] Instance has NOT been bootstrapped
  2021/11/22 14:15:51.999334 [INFO] Executing instruction: GetSetupLogRotate
  2021/11/22 14:15:51.999345 [INFO] Initialize LogRotate files and directories
  2021/11/22 14:15:52.175325 [INFO] Instance has NOT been bootstrapped
  2021/11/22 14:15:52.175342 [INFO] Executing instruction: BootstrapCFNHup
  2021/11/22 14:15:52.175346 [INFO] Bootstrap cfn-hup
  2021/11/22 14:15:52.193853 [INFO] Copying file /opt/elasticbeanstalk/config/private/aws-eb-command-handler.conf to /etc/cfn/hooks.d/aws-eb-command-handler.conf
  2021/11/22 14:15:52.212323 [INFO] Executing instruction: StartCFNHup
  2021/11/22 14:15:52.212338 [INFO] Start cfn-hup
  2021/11/22 14:15:52.212358 [INFO] Running command /bin/sh -c systemctl is-active cfn-hup.service
  2021/11/22 14:15:52.216412 [INFO] Running command /bin/sh -c systemctl is-active cfn-hup.service
  2021/11/22 14:15:52.230426 [INFO] Running command /bin/sh -c systemctl show -p PartOf cfn-hup.service
  2021/11/22 14:15:52.299834 [INFO] Running command /bin/sh -c systemctl daemon-reload
  2021/11/22 14:15:52.446631 [INFO] Running command /bin/sh -c systemctl reset-failed
  2021/11/22 14:15:52.459702 [INFO] Running command /bin/sh -c systemctl is-enabled aws-eb.target
  2021/11/22 14:15:52.482604 [INFO] Running command /bin/sh -c systemctl enable aws-eb.target
  2021/11/22 14:15:52.649789 [INFO] Running command /bin/sh -c systemctl start aws-eb.target
  2021/11/22 14:15:52.654616 [INFO] Running command /bin/sh -c systemctl enable cfn-hup.service
  2021/11/22 14:15:52.807548 [INFO] Running command /bin/sh -c systemctl show -p PartOf cfn-hup.service
  2021/11/22 14:15:52.813053 [INFO] Running command /bin/sh -c systemctl is-active cfn-hup.service
  2021/11/22 14:15:52.826743 [INFO] Running command /bin/sh -c systemctl start cfn-hup.service
  2021/11/22 14:15:52.902844 [INFO] Instance has NOT been bootstrapped
  2021/11/22 14:15:52.902858 [INFO] Executing instruction: SetupPublishLogCronjob
  2021/11/22 14:15:52.902862 [INFO] Setup publish logs cron job...
  2021/11/22 14:15:52.902867 [INFO] Copying file /opt/elasticbeanstalk/config/private/logtasks/cron/publishlogs to /etc/cron.d/publishlogs
  2021/11/22 14:15:52.904643 [INFO] Instance has NOT been bootstrapped
  2021/11/22 14:15:52.904653 [INFO] Executing instruction: MarkBootstrapped
  2021/11/22 14:15:52.904657 [INFO] Starting MarkBootstrapped
  2021/11/22 14:15:52.904662 [INFO] Instance has NOT been bootstrapped
  2021/11/22 14:15:52.904711 [INFO] Marked instance as Bootstrapped
  2021/11/22 14:15:52.904716 [INFO] Executing instruction: Save CFN Stack Info
  2021/11/22 14:15:52.904754 [INFO] Starting SwitchCFNStack
  2021/11/22 14:15:52.904759 [INFO] Executing cleanup logic
  2021/11/22 14:15:52.904767 [INFO] Platform Engine finished execution on command: env-launch
  
  2021/11/22 14:16:30.856582 [INFO] Starting...
  2021/11/22 14:16:30.856626 [INFO] Starting EBPlatform-PlatformEngine
  2021/11/22 14:16:30.856641 [INFO] reading event message file
  2021/11/22 14:16:30.856756 [INFO] no eb envtier info file found, skip loading env tier info.
  2021/11/22 14:16:30.856819 [INFO] Engine received EB command cfn-hup-exec
  
  2021/11/22 14:16:30.930939 [INFO] Running command /bin/sh -c /opt/aws/bin/cfn-get-metadata -s arn:aws:cloudformation:eu-west-2:683129997034:stack/awseb-e-q5mrmib7vk-stack/6b2c3ce0-4b9e-11ec-8876-0a9a519e5c50 -r AWSEBAutoScalingGroup --region eu-west-2
  2021/11/22 14:16:31.244459 [INFO] Running command /bin/sh -c /opt/aws/bin/cfn-get-metadata -s arn:aws:cloudformation:eu-west-2:683129997034:stack/awseb-e-q5mrmib7vk-stack/6b2c3ce0-4b9e-11ec-8876-0a9a519e5c50 -r AWSEBBeanstalkMetadata --region eu-west-2
  2021/11/22 14:16:31.557974 [INFO] checking whether command app-deploy is applicable to this instance...
  2021/11/22 14:16:31.557989 [INFO] this command is applicable to the instance, thus instance should execute command
  2021/11/22 14:16:31.557993 [INFO] Engine command: (app-deploy)
  
  2021/11/22 14:16:31.558000 [INFO] Downloading EB Application...
  2021/11/22 14:16:31.558003 [INFO] Region: eu-west-2
  2021/11/22 14:16:31.558008 [INFO] envID: e-q5mrmib7vk
  2021/11/22 14:16:31.558012 [INFO] envBucket: elasticbeanstalk-eu-west-2-683129997034
  2021/11/22 14:16:31.558016 [INFO] Using manifest file name from command request
  2021/11/22 14:16:31.558027 [INFO] Unable to get version manifest file.
  2021/11/22 14:16:31.558031 [INFO] Downloading latest manifest available.
  2021/11/22 14:16:31.558035 [INFO] Download latest app version manifest
  2021/11/22 14:16:31.558117 [INFO] resources/environments/e-q5mrmib7vk/_runtime/versions/manifest
  2021/11/22 14:16:31.605213 [INFO] latestManifest key *: resources/environments/e-q5mrmib7vk/_runtime/versions/manifest_1637590431113
  
  2021/11/22 14:16:31.605416 [INFO] Downloading: bucket: elasticbeanstalk-eu-west-2-683129997034, object: /resources/environments/e-q5mrmib7vk/_runtime/versions/manifest_1637590431113
  2021/11/22 14:16:31.623569 [INFO] Download successful143bytes downloaded
  2021/11/22 14:16:31.623680 [INFO] Trying to read and parse version manifest...
  2021/11/22 14:16:31.623754 [INFO] Downloading: bucket: elasticbeanstalk-eu-west-2-683129997034, object: /resources/environments/e-q5mrmib7vk/_runtime/_versions/test-web-app-2/test-web-app-2-source
  2021/11/22 14:16:31.639717 [INFO] Download successful221bytes downloaded
  2021/11/22 14:16:31.639982 [INFO] Executing instruction: ElectLeader
  2021/11/22 14:16:31.639990 [INFO] Running leader election for instance i-0d6ccb7d389509951...
  2021/11/22 14:16:31.639994 [INFO] Calling the cfn-elect-cmd-leader to elect the command leader.
  2021/11/22 14:16:31.640008 [INFO] Running command /bin/sh -c /opt/aws/bin/cfn-elect-cmd-leader --stack arn:aws:cloudformation:eu-west-2:683129997034:stack/awseb-e-q5mrmib7vk-stack/6b2c3ce0-4b9e-11ec-8876-0a9a519e5c50 --command-name ElasticBeanstalkCommand-AWSEBAutoScalingGroup --invocation-id eb635534-021a-4fe9-8434-792399608524 --listener-id i-0d6ccb7d389509951 --region eu-west-2
  2021/11/22 14:16:31.942922 [INFO] Instance is Leader.
  2021/11/22 14:16:31.942974 [INFO] Executing instruction: stopSqsd
  2021/11/22 14:16:31.942980 [INFO] This is a web server environment instance, skip stop sqsd daemon ...
  2021/11/22 14:16:31.942984 [INFO] Executing instruction: PreBuildEbExtension
  2021/11/22 14:16:31.942988 [INFO] Starting executing the config set Infra-EmbeddedPreBuild.
  2021/11/22 14:16:31.943008 [INFO] Running command /bin/sh -c /opt/aws/bin/cfn-init -s arn:aws:cloudformation:eu-west-2:683129997034:stack/awseb-e-q5mrmib7vk-stack/6b2c3ce0-4b9e-11ec-8876-0a9a519e5c50 -r AWSEBAutoScalingGroup --region eu-west-2 --configsets Infra-EmbeddedPreBuild
  2021/11/22 14:16:32.274922 [INFO] Finished executing the config set Infra-EmbeddedPreBuild.
  
  2021/11/22 14:16:32.274957 [INFO] Executing instruction: StageApplication
  2021/11/22 14:16:32.277039 [ERROR] An error occurred during execution of command [app-deploy] - [StageApplication]. Stop running the command. Error: staging application failed due to invalid zip file 
  
  2021/11/22 14:16:32.277047 [INFO] Executing cleanup logic
  2021/11/22 14:16:32.277145 [INFO] CommandService Response: {&quot;status&quot;:&quot;FAILURE&quot;,&quot;api_version&quot;:&quot;1.0&quot;,&quot;results&quot;:[{&quot;status&quot;:&quot;FAILURE&quot;,&quot;msg&quot;:&quot;Engine execution has encountered an error.&quot;,&quot;returncode&quot;:1,&quot;events&quot;:[{&quot;msg&quot;:&quot;Instance deployment: Your source bundle has issues that caused the deployment to fail. For details, see 'eb-engine.log'.&quot;,&quot;timestamp&quot;:1637590592,&quot;severity&quot;:&quot;ERROR&quot;},{&quot;msg&quot;:&quot;Instance deployment failed. For details, see 'eb-engine.log'.&quot;,&quot;timestamp&quot;:1637590592,&quot;severity&quot;:&quot;ERROR&quot;}]}]}
  
  2021/11/22 14:16:32.277270 [INFO] Platform Engine finished execution on command: app-deploy
  
  2021/11/22 14:18:21.855084 [INFO] Starting...
  2021/11/22 14:18:21.855127 [INFO] Starting EBPlatform-PlatformEngine
  2021/11/22 14:18:21.855142 [INFO] reading event message file
  2021/11/22 14:18:21.855239 [INFO] no eb envtier info file found, skip loading env tier info.
  2021/11/22 14:18:21.855295 [INFO] Engine received EB command cfn-hup-exec
  
  2021/11/22 14:18:21.922105 [INFO] Running command /bin/sh -c /opt/aws/bin/cfn-get-metadata -s arn:aws:cloudformation:eu-west-2:683129997034:stack/awseb-e-q5mrmib7vk-stack/6b2c3ce0-4b9e-11ec-8876-0a9a519e5c50 -r AWSEBAutoScalingGroup --region eu-west-2
  2021/11/22 14:18:22.221728 [INFO] Running command /bin/sh -c /opt/aws/bin/cfn-get-metadata -s arn:aws:cloudformation:eu-west-2:683129997034:stack/awseb-e-q5mrmib7vk-stack/6b2c3ce0-4b9e-11ec-8876-0a9a519e5c50 -r AWSEBBeanstalkMetadata --region eu-west-2
  2021/11/22 14:18:22.531687 [INFO] checking whether command tail-log is applicable to this instance...
  2021/11/22 14:18:22.531701 [INFO] this command is applicable to the instance, thus instance should execute command
  2021/11/22 14:18:22.531706 [INFO] Engine command: (tail-log)
  
  2021/11/22 14:18:22.531774 [INFO] Executing instruction: GetTailLogs
  2021/11/22 14:18:22.531781 [INFO] Tail Logs...
  2021/11/22 14:18:22.532134 [INFO] Running command /bin/sh -c tail -n 100 /var/log/eb-engine.log
  </code></pre>
  <pre><code>An error occurred during execution of command [app-deploy] - [StageApplication]. Stop running the command. Error: staging application failed due to invalid zip file
  </code></pre>
  <p>Of which zip is it talking about ? I gave him a <code>Dockerrun.aws.json</code>. The error is on the code ? Why isn't it failing on the execution then ?</p>