AWS Lambda Error: Could not unzip uploaded file
ZipFile
needs to be a Buffer
.
That means you have to read the file and convert it to a Buffer
object.
You can use fs.readFile()
or fs.readFileSync()
to do this.
Your ZipFile params is incorrect, it must be a buffer. Try change to :
var fs = require('fs');
var params = {
FunctionName: 'FunctionName',
ZipFile: fs.readFileSync('deploy_package.zip')
}
lambda.updateFunctionCode(params, function(err, data) {
if (err) console.log(err, err.stack);
else console.log(data);
});