exiftool-vendored.js: Error: spawn /var/task/node_modules/exiftool-vendored.pl/bin/exiftool ENOENT

exiftool can not be spawned in aws lambda environment, getting below error stack:

2019-07-18T14:45:17.836Z	288aa49b-491d-5394-a451-f131c125cf30	Error: spawn /var/task/node_modules/exiftool-vendored.pl/bin/exiftool ENOENT
at _errnoException (util.js:1022:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
at onErrorNT (internal/child_process.js:372:16)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickDomainCallback (internal/process/next_tick.js:218:9)

Using lambci/lambda:nodejs8.10 image (https://github.com/lambci/docker-lambda) the problem can be reproduced. The error happens when initializing the below Metadata class

export default class Metadata {

    private static tool: ExifTool = Metadata.initTool();

    public static tmpDirectory = `${tmpdir()}/metadata`;

    private static initTool(): ExifTool {
        logger.debug("initializing exiftool...");
        const tool = new ExifTool();
        tool.version().then(version => logger.info(`ExifTool version ${version}`));
        return tool;
    }

Thanks for the great tool

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 24 (8 by maintainers)

Most upvoted comments

Cool, I’ll

investigated a bit and I find that /usr/bin/perl is present in 2017.03 but not present in 2018.03. This is a bit of a letdown. I am unable to find any communication as to what exactly has changed between the two environments. All I see is a pointer to the 2018.03 Amazon Linux release notes, which does not mention anything about perl. There is no Lambda specific release notes about the differences between the versions.

@douglassaldana have you got a chance to try out 8.17?

hi, i dont use the library i was just passing by and see the error and try to help

Using

#!/usr/bin/env perl

as the shebang line does not work, causes

FATAL ERROR: v8::ToLocalChecked Empty MaybeLocal.
#!/opt/bin/perl -w

works

@douglassaldana is there an easy way to see what is installed on a lambda ami?

On your lambda function exports.handler = function(event, context, callback) { const { spawn } = require( ‘child_process’ ), ls = spawn( ‘ls’, [ ‘/usr/bin’ ] );

ls.stdout.on( 'data', data => {
    console.log( `stdout: ${data}` );
} );

ls.stderr.on( 'data', data => {
    console.log( `stderr: ${data}` );
} );

ls.on( 'close', code => {
    console.log( `child process exited with code ${code}` );
} );

};

you will see that perl is no there, if that your case

You have to : 1 - Add a layer on Lambda choose one from ->Perl LAYERS (that will install perl on AMI) 2 - Then on exiftool change #!/usr/bin/perl -w for #!/opt/bin/perl -w

I have same issue using exiftool Lib, it seen that the new version of AMI in Lambda doesn’t have perl installed!