Description
For the past couple of hours I've been trying to setup exiftool
on an Lambda instance and have a Node handle invoke it, process the output and send it back. I've managed to set this up easily for ffprobe
since I could just upload it as a static binary (although now I realise that I can use a layer for that).
Since exiftool
is a script I was trying to install perl
somehow and finally, after a lot of digging I found this nice solution.
I'm using the Serverless framework and my .yml
is minimal:
provider:
name: aws
runtime: nodejs10.x
versionFunctions: false
region: eu-central-1
functions:
hello:
handler: handler.hello
layers:
- arn:aws:lambda:eu-central-1:652718333417:layer:perl-5_26-layer:1
The handler function is also minimal, it executes an command that is sent to it:
module.exports.hello = (event, context, callback) => {
if (event.cmd) {
const child = child_process.exec(event.cmd, (error, stdout, stderr) => {
// Resolve with result of process
callback(null, { error, stdout, stderr });
});
}
}
And I'm sending the follwing json:
{
"cmd": "perl -ver"
}
It deploys without problems but when I try to invoke it, I get the following error:
{
"error": {
"killed": false,
"code": 127,
"signal": null,
"cmd": "perl -ver"
},
"stdout": "",
"stderr": "perl: error while loading shared libraries: libcrypt.so.1: cannot open shared object file: No such file or directory\n"
I'm still new to the whole serverless architecture stuff so there may be a simple solution but I can't seem to find it. Any help would be appreciated.