You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to deploy my express node application that contains hummus and hummus-recipe to an elastic beanstalk instance but it seems to be stopping the read functionality. Running the application locally works absolutely fine and I have no issues whatsoever. When I try an run my PDF editing function I get
Error: TypeError: Unable to start parsing PDF file
at Recipe.read (/var/app/current/node_modules/hummus-recipe/lib/Recipe.js:165:19)
at Recipe._createWriter (/var/app/current/node_modules/hummus-recipe/lib/Recipe.js:61:18)
at new Recipe (/var/app/current/node_modules/hummus-recipe/lib/Recipe.js:49:14)
at /var/app/current/functions/pdf-functions.js:10:20
at new Promise (<anonymous>)
at Object.annotateDoc (/var/app/current/functions/pdf-functions.js:8:10)
at /var/app/current/index.js:112:18
at Layer.handle [as handle_request] (/var/app/current/node_modules/express/lib/router/layer.js:95:5)
at next (/var/app/current/node_modules/express/lib/router/route.js:137:13)
at Route.dispatch (/var/app/current/node_modules/express/lib/router/route.js:112:3)
I have tried a few possible fixes including:
Verifying that the pdf is indeed in the location I am trying to read from
Using a preprocessed version of hummus-recipe from another EC2 box with the same setup as my elastic beanstalk
The code below is the snippet that I am trying to get working:
const HummusRecipe = require("hummus-recipe");
var annotateDoc = (fileVersion, ip, emailAddress, country) => {
console.log("Using " + fileVersion + " to create new pdf called " +
"public/documents/whitepaper_" + ip + "_" + country + ".pdf");
return new Promise(function(resolve, reject) {
const pdfDoc = new HummusRecipe(
fileVersion,
"public/documents/whitepaper_" + ip + "_" + country + ".pdf"
);
var text =
"This document was produced for viewing by " +
(ip || "") +
" " +
emailAddress +
" in " +
(country || "") +
" region";
pdfDoc
// edit 1st page
.editPage(1)
.text(text, 30, 10, {
color: "#000000",
size: 12
})
.endPage()
// end and save
.endPDF(function(e) {
console.log(e)
resolve("documents/whitepaper_" + ip + "_" + country + ".pdf");
});
});
};
module.exports = {
annotateDoc
};
I may be missing something very basic but any help on this would be great
The text was updated successfully, but these errors were encountered:
good chances are that the file is not there or don't have read permissions.
so how about try to log the file content. this should bring you closer toe the true cause of problem.
not sure what the path ""public/documents/whitepaper_" + ip + "_" + country + ".pdf""
means, so it might be that you want a little ./ as prefix for relative, or ~/ for absolutes.
I'm trying to deploy my express node application that contains hummus and hummus-recipe to an elastic beanstalk instance but it seems to be stopping the read functionality. Running the application locally works absolutely fine and I have no issues whatsoever. When I try an run my PDF editing function I get
I have tried a few possible fixes including:
Verifying that the pdf is indeed in the location I am trying to read from
Using a preprocessed version of hummus-recipe from another EC2 box with the same setup as my elastic beanstalk
The code below is the snippet that I am trying to get working:
I may be missing something very basic but any help on this would be great
The text was updated successfully, but these errors were encountered: