1

Edit: I think this is due to my vm running out of space. Also curious, when adm-zip writes into a new zip doesn't it remove the files from the local directory(soruce) and write them into Zip folder (destination) ?

I'm trying to zip a folder using adm-zip and running into the following error. Is this a known bug ? Or Am I doing something dumb ?

INFO    started zipping from source: /tmp/unzippedBuild/lambda to destination: /tmp/postBuild.zip

ERROR   RangeError [ERR_OUT_OF_RANGE]: The value of "value" is out of range. It must be >= 0 and <= 65535. Received 92171
    at checkInt (internal/buffer.js:35:11)
    at writeU_Int16LE (internal/buffer.js:539:3)
    at Buffer.writeUInt16LE (internal/buffer.js:547:10)
    at Object.toBinary (/var/task/node_modules/adm-zip/headers/mainHeader.js:73:15)
    at Object.compressToBuffer (/var/task/node_modules/adm-zip/zipFile.js:305:24)
    at Object.writeZip (/var/task/node_modules/adm-zip/adm-zip.js:618:23)
    at Object.exports.makeZip (/var/task/utils/zipHelper.js:20:13)
    at Runtime.exports.buildHandler [as handler] (/var/task/index.js:31:19)
    at process._tickCallback (internal/process/next_tick.js:68:7)

My code looks like this:

exports.makeZip = function(source, destination) {
    console.info("started zipping from source: %s to destination: %s", source, destination);
    try {
        const zip = new AdmZip();
        zip.addLocalFolder(source);
        zip.writeZip(destination);
        console.info("done zipping");
    } catch (error) {
        console.error(error.stack)
        console.error("Zipping failed. Reason: %s", error)
        throw new Error(error.message)
    }
};

du command gives the following size.

525688  /tmp/unzippedBuild/lambda
Novice
  • 423
  • 1
  • 9
  • 17
  • Same issue for me using `adm-zip`. It seems to occur when what I'm zipping is very large. `RangeError [ERR_OUT_OF_RANGE]: The value of "value" is out of range. It must be >= 0 and <= 4294967295. Received -6324224` My trace looks just like yours except for `Object.toBinary` where I instead have: `at Object.dataHeaderToBinary (./node_modules/adm-zip/headers/entryHeader.js:204:18)` – FactoryAidan Jan 01 '21 at 05:50
  • any solution for this? – Amir Torkashvand Apr 20 '21 at 21:02

0 Answers0