pdffiller-stream
pdffiller-stream copied to clipboard
Unable to fill form when using with aws lambda
I have having trouble using pdffiller with AWS lambda.
Error: spawn EACCES
at _errnoException (util.js:1022:11)
at ChildProcess.spawn (internal/child_process.js:323:11)
at exports.spawn (child_process.js:502:9)
at exports.execFile (child_process.js:212:15)
at Object.fillFormWithOptions (/var/task/node_modules/pdffiller-aws-lambda/index.js:129:13)
at Promise (/var/task/handler.js:574:21)
at new Promise (<anonymous>)
at fillDocument (/var/task/handler.js:573:16)
at module.exports.processDocument (/var/task/handler.js:626:27) code: 'EACCES', errno: 'EACCES', syscall: 'spawn' }
I am simply using fillFormWithOptions or fillForm function. The issue is with both of them.
pdfFiller.fillFormWithOptions(
`https://unlockd-static-files.s3.us-east-2.amazonaws.com/${documentId}.pdf`,
`/tmp/${listingId}_${documentId}.pdf`,
values,
false,
"/tmp/",
error => {
if (!error) {
resolve("Success. Pdf document is been process");
} else {
reject(error);
}
}
);
});
Any Help will be much appreciated.
@ImNoumanDilshad look into pdffiller-aws-lambda
The problem is, it does not support streaming, and will try to write to a file instead. Looking into a workaround ...
That error spawn EACCES looks like a missing executable or permissions problem; would usually be fired if your lambda's deployed zip file doesn't contain the binary for pdftk or can't execute it. It looks like the discussion here was also pointing in that direction... so far I haven't had a need / chance to deploy on Lambda, so I haven't been able to check this out. A good library to examine might be: https://github.com/lob/lambda-pdftk-example