I am using the node module pdf-to-text for my Nodejs lambda function, but I was getting a "spawn pdftotext ENOENT
" error. I tried launching an AWS EC2 instance and compiling poppler there using this script. I managed to get a tar.gz file on S3 which contains a popplar file and within that a bin and lib folder inside.
However, when I reference that poppler file placed in a bin folder like this:
process.env['PATH'] = process.env['PATH'] + ':' + path.join(process.env['LAMBDA_TASK_ROOT'], '/bin/poppler');
That did not work. I got an spawn ENOTDIR
error. I then unzipped it and tried referencing the bin folder inside the file: 'bin/bin' but I got a spawn EACCES
error.
I tried directly referencing the "bin/pdftotext" as well and got the spawn ENOTDIR
error again.
Does anyone have any luck putting this library in a lambda function?
TL;DR, I want to run the command spawn('pdftotext')
in my lambda function.
Made some progress, I did a chmod on the poppler folder and now I'm getting this error:
Error: pdf-text-extract command failed: pdftotext: error while loading shared libraries: libpoppler.so.56: cannot open shared object file: No such file or directory