I got Error: spawn EACCES
error at the following line when I tried to execute this in aws lambda.
var zip = childProcess.spawn('zip', [
'-r',
job.destination.name,
'./'
], {
cwd: temporaryDirectoryPath
});
I have a binary file 'zip'.
Full error trace:
Error: spawn EACCES
at exports._errnoException (util.js:1018:11)
at ChildProcess.spawn (internal/child_process.js:319:11)
at Object.exports.spawn (child_process.js:378:9)
at createCompressedFile (/var/task/index.js:141:32)
at /var/task/node_modules/async/lib/async.js:718:13
at iterate (/var/task/node_modules/async/lib/async.js:262:13)
at /var/task/node_modules/async/lib/async.js:274:29
at /var/task/node_modules/async/lib/async.js:44:16
at /var/task/node_modules/async/lib/async.js:723:17
at /var/task/node_modules/async/lib/async.js:167:37
cwd : temporaryDirectoryPath
, when the user your process is running as doesn't have access totemporaryDirectoryPath
. – robertklepvar mkdir = childProcess.spawn('mkdir', [ temporaryDirectoryPath ], { cwd: __dirname });
– NPCRNPCRtemporaryDirectoryPath = path.join('/tmp', context.awsRequestId);
– NPCRNPCRfs.mkdir
instead of spawning a child process to callmkdir
. – robertklep