Support Forums

Using Dropbox SDK and AdmZip results in no file changes when deploying

I have a build script that uses the Dropbox SDK to download a ZIP file, then using AdmZip to extract it into the Node file system. It works great on local, but on Netlify it seems to only work the first time, then after that I suspect some caching is getting in the way and it seems to only extract the old ZIP file. If I make a change to a file in Dropbox, and re-deploy it won’t have the new file in the deploy.


// Init Dropbox SDK
const dbx = new Dropbox({
    accessToken: process.env.DBX_ACCESS_TOKEN,

// Clean up any directory we made previously
const DIST_PATH = path.resolve(__dirname, "../dist")
const DECK_PATH = path.resolve(__dirname, `..${process.env.DBX_PATH}`)

// Download ZIP file of folder from Dropbox, and extract everything
dbx.filesDownloadZip({ path: process.env.DBX_PATH })
    .then((response) => {
        // Download dropbox folder as ZIP, unzip
        console.log("Recieved ZIP from Dropbox:", response.result.metadata.name)
        var zip = new AdmZip(response.result.fileBinary)
        zip.extractAllTo("./", true)

        // Rename folder now
        fs.renameSync(DECK_PATH, DIST_PATH)

        // Logout file count
        console.log("Added following folders:")
        fs.readdirSync(DIST_PATH).forEach((file, index) => {
            console.log("[" + index + "] " + file)

        // Copy templates to dist for things like admin and robots.txt
        // This does not overwrite files, so the user can have a custom root index file for example
        fs.copySync("./src/templates", DIST_PATH, {
            overwrite: false,
    .catch((error) => {

I boned it. Forgot about the Netlify concept of a “deploy” and then you have to “publish” that deploy. I had turned off the auto Publish feature as I was setting everything up, and forgot to turn it back on. I spent probably 4 hours trying to figure out why the new code wasn’t working. Dang.

1 Like

Hi, @drewbaker. It is very helpful to follow-up with the root cause and solution like you did.

Our support team really (really, really) appreciate it when people take the time to do that and we thank you for taking the time and effort to share your solution here. :+1:

1 Like