Is there a way to solve pdftk ENOENT error?

83 Views Asked by At

So I am working on a service using Node 14.17.3 which uses pdfFiller library. Everything is working perfectly fine on my development system when I execute my code but when I pushed the code to server it started giving errors when that specific pdfFiller function got called.

exec error: Error: spawn pdftk ENOENT

Further debugging I got to know that in my docker file which gets executed while on server due to pdftk package it might gave that error, not so sure about that but that is my best guess.

The error when that specific api gets executes is below:

exec error: Error: spawn pdftk ENOENT
UnhandledPromiseRejectionWarning: Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client

The status code is 500 on the docker console.

The docker file contains this:

RUN apk update && apk upgrade && \
    apk add --no-cache bash git tzdata python3 py3-pip make g++ pdftk

The code where it might gets the error

try {
      pdfFiller.fillForm(sourcePDF, destinationPDF, mandate_data, (err) => {
        if (err) {
          throw new baseException(
            `Exception at FillForm in generating pdf from fdf ${err}`
          );
        }
        resolve(destinationPDF);
      });
    } catch (error) {
      resolve(error);
    }

Again it is working completed fine on my development system but not on server.

0

There are 0 best solutions below