AWS Lambda, node, adm-zip: bad address in system call argument

706 Views Asked by At

Can create and read /tmp/temp.zip with AWS Lambda but this line causes an error:

var zip = new AdmZip("/tmp/temp.zip"); // https://www.npmjs.com/package/adm-zip

What does the error mean?

2018-08-08T13:23:41.074Z    2c1d866d-9b0e-11e8-8f32-8b0d6b822525    Error: EFAULT: bad address in system call argument, read
    at Object.fs.readSync (fs.js:675:18)
    at tryReadSync (fs.js:540:20)
    at Object.fs.readFileSync (fs.js:575:19)
    at new module.exports (/var/task/node_modules/adm-zip/zipFile.js:17:17)
    at new module.exports (/var/task/node_modules/adm-zip/adm-zip.js:20:11)
    at PassThrough.readStream.on (/var/task/index.js:28:19)
    at emitNone (events.js:111:20)
    at PassThrough.emit (events.js:208:7)
    at endReadableNT (_stream_readable.js:1064:12)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
END RequestId: 2c1d866d-9b0e-11e8-8f32-8b0d6b822525
REPORT RequestId: 2c1d866d-9b0e-11e8-8f32-8b0d6b822525  Duration: 39773.72 ms   Billed Duration: 39800 ms   Memory Size: 128 MB Max Memory Used: 128 MB 
RequestId: 2c1d866d-9b0e-11e8-8f32-8b0d6b822525 Process exited before completing request
1

There are 1 best solutions below

0
On BEST ANSWER

The clue:

Memory Size: 128 MB Max Memory Used: 128 MB

So the lambda was running out of memory. Giving it 1024 MB solved the problem.