Deploying via zip file using REST API issues

I am following the walk through on https://www.netlify.com/docs/api/#endpoints to upload a zip file to deploy. I send the following requets to netlify. (my ‘website.zip’ file contains a single ‘index.html’ file). I am in the same directory as zip file when I run the following command.

curl -H "Content-Type: application/zip" \
 -H "Authorization: Bearer xx-xxx-xxx" \
 --data-binary "@website.zip" \
 https://api.netlify.com/api/v1/sites/xxx-xxxx-xxx-xxxx/deploys

It goes through, and returns an object with the status, id, ect. However when I go into the admin UI, I see that my deploy failed. The message says ‘Deploy processing failed after 5 attempts’ and the log is below.

10:11:55 AM: Unpacking archive
10:11:56 AM: Unpacking archive
10:11:56 AM: Unpacking archive
10:11:56 AM: Unpacking archive
10:11:56 AM: Unpacking archive

I also tried an incorrect file location just for testing, and the UI then says ‘empty zip file’. Maybe this is the incorrect way to go about this. My entire mission is to let the user edit the html -> server builds a new zip archive with updated html -> use Netlify API to upload new zip file to production from server. Maybe I should be using the digest method instead? Any help or guidance is greatly appreciated!

Hi Garrett,

The zipfile seems to be corrupt. This is the internal error we receive:

Error extracting zip: Zip end of central directory signature not found

Please make sure you use only a zip program and not 7zip or anything else “fancy”. I would verify a zipfile on linux or dos or OSX (sorry, not sure how to do it on windows) by using something like:

unzip -t file.zip

I seem to be having the exact same problem, I was able to unzip the file without any issues ?

Hi @shaun, Did you verify your file using the method fool mentioned? If not, can you detail what utility you used to check?

Hi Dennis,

Thanks for getting back to me.

I used Debian Linux, regular zip command. Then I tried unzipping it as Fool suggested and I was able to unzip the index.html file just fine, using unzip

Shaun

@shaun can you share a link to one of your deploys that failed? and is the zip archive available somewhere for us to take a look at?

I have the same problem - here is one of my failing deploys: https://app.netlify.com/sites/elegant-mahavira-2feb41/deploys/5e1726c08e0e91bc2e04b1e3

We’ve tried Alpine Linux’s (3.9) zip and p7zip packages and the macOS-integrated archiver utility to no avail.
Commands used:
zip: zip -9 -i@ziplist.txt -r ${DEPLOY_ZIP_NAME} .
p7zip: 7z a -tzip "${DEPLOY_ZIP_NAME}" "@ziplist.txt"

Uploaded via curl: curl -H "Content-Type: application/zip" -H "Authorization: Bearer ${NETLIFY_API_TOKEN}" --data-binary "@${DEPLOY_ZIP_NAME}" https://api.netlify.com/api/v1/sites/${NETLIFY_SITE_ID}/deploys
(as shown in the docs)

We also made sure that the Zip files would decompress properly with different tools and configurations, there didn’t seem to be any corruption or invalid files on our side of things.

The error we see internally is:

too many zip entries

How many files are in the zipfile?

There are 40 files in our current build - are you getting the same error for our previous attempts?

Also, It would be nice to see these errors exposed in the build logs :slight_smile:

Hi @michaela,

Do you have your 40 files in a folder inside the zip file or are these files all in the root of the zip file?

Regarding exposing those errors, I’ve added this thread to the enhancement request to improve this and we’ll update here if and when we get that implemented.

Hi @Dennis,
there are some in the root of the zip file and nested folders and files, up to three levels deep; usually 1-4 files per folder - no deeply nested zip bomb shenanigans or the like…

Thanks for forwarding my request!

1 Like