Please give a brief summary of your issue:
Getting error attempting Word Fill POC Locally on Mac
Please describe your issue and provide steps to reproduce it:
I am using a MBP (Ventura 13.5.2 Apple M1 Pro). I am evaluating the Node SDK for Word Fill for eventual use on AWS Lambda but I’m locally trying to get a Lambda working on my mac. I use serverless-offline plugin to run my lambdas locally. I have set esbuild to ignore trying to bundle the @pdftron reference.
I am using Node v18.14.2 locally. I get this fatal error when running.
I was able to get the pdfnet-node-samples working locally.
Internally at Apryse do you know if anyone has any local Lambda emulation setups working or within QA? It may very well be the serverless-offline program in terms of how it mimics API Gateway and Lambda creates some kind of mismatch with the node-addon lib (which appears to be what throws up in the stack).
I’d ideally be able to run tests locally before pushing to AWS but perhaps that might not be possible in my setup. Thanks.
Sorry to bug you but I’m trying to conduct my test on AWS now and I’m getting an error:
Failure in main Error: /opt/nodejs/node_modules/@pdftron/pdfnet-node/lib/addon.node: invalid ELF header
I searched the forum and I do see another ticket where you mentioned its a binary issue.
What I’m trying to understand is how do I get a proper Lambda Layer working with PDFTron. Locally I have a Mac M1 machine and I was able to follow the downloading of the NodeJs pdfnet samples and can run that locally on my machine.
I took the node_modules folder within the samples project node_modules and put that into a zip file which I uploaded as a layer w/ architecture X86_64.
Our Lambdas are bundled using ESBuild so I marked @pdftron/pdfnet-node as an external and tied the layer to my lambda. I have the Lambda marked to use X86_64 as well along with 10240 of memory.
Note that I did try the same exercise with the Layer marked as ARM64 and the Lambda also marked as ARM64 but it did not seem to work.
In terms of the steps to “deploy the… binary”. Its a node lambda so I’m referencing a node_modules path. Would I take my local pdfnet-node node_modules folder and then replace the lib folder contents with the binary to use on AWS?
Sorry if thats a dense question. When I tried to go to the Apryse Developer Portal page, the download button for Node just took me to the NPM page which I what I was using locally.
Thanks for your help. Hopefully I’m only a little guidance from getting this settled.
@Ryan is it possible to send me a link to the prebuilt SDK binary for Linux ARM64 from the https://nightly-pdftron-uploads.s3.us-west-1.amazonaws.com/ site similar to what you sent above for the Mac OS? I’m not totally sure if I can build the Linux binary on my Mac without getting into using a Docker image so I figured I’d ask if PDF Tron already posts pre-built binaries for the different targets that I could just download directly and use for my Lambda layer.
For any future folks looking at this ticket. If you’re like me and working on a local machine OS different from what your AWS target will be you can use the nightly build outputs (example here, Apryse Developer Portal) and find the target Zip that you need for your particular case.
Then depending on your bundling process you might include the node_modules folder with your Lambda bundle or you might be using Layers. I was using layers but you can take that Zip and use it as your source for your lambda layer. Then just make sure you have your compatible architectures properly configured on your lambda and layer to match the zip you used.