shelfio / libreoffice-lambda-layer

MIT License
112 stars 22 forks source link

blank pdf and docx documents after first successfull call #40

Closed cesarpachon closed 2 years ago

cesarpachon commented 3 years ago

hello, I am converting from ODT to either PDF or DOCX documents. It works well the first time you deploy and call the lambda, but after the second call, I obtain in return empty documents (either PDF or DOCX). I have the Fontconfig error message mentioned here https://github.com/shelfio/libreoffice-lambda-layer/issues/23 but as the first time it works, I am assuming that is not the error that causes blank responses in the next calls. I wonder if someone had experienced a similar issue?

Jun711 commented 2 years ago

@cesarpachon How did you unpack lo.tar.br or lo.tar.gz?

elebumm commented 2 years ago

Was this ever solved?

cesarpachon commented 2 years ago

hello yes it is solved, the issue was that the path to the file to open was wrong, so libreoffice just open with a new, blank document. I am marking the issue as closed. thks!

elebumm commented 2 years ago

@cesarpachon I seem to be running into the same issue with the document being blank only on the times after I initially run. What's happening to the file on the runs after?

cesarpachon commented 2 years ago

hi @elebumm I took me some minutes to review my repo log around the date I posted this issue, but apart from adding the layer with the fonts I found no comments that may be of help..

perhaps one thing I remember (and may not be related) is that after I checked the "convertTo" method, I notice that the method cleans the /tmp folder. so my guess is that I was using some fixed path for the temporal files, and the file was being deleted between calls to the lambda. I refactored to use a npm package that generates random tempfiles (in my case, I open the ODT, parse the content.xml with handlebars templates, then re-pack the ODT before opening in LO, that's why I am using temporal files).