dockerfiles icon indicating copy to clipboard operation
dockerfiles copied to clipboard

PhantomJS (local) - HTTP408 / Failed to load PDF document

Open HeyWatchOutDude opened this issue 2 years ago • 4 comments

Hi,

im unable to generate PDF files via phantomjs - local.

.env configuration: (related to phantomjs - local) PHANTOMJS_PDF_GENERATOR=TRUE PDF_GENERATOR=phantom PHANTOMJS_SECRET=<KEY> PHANTOMJS_BIN_PATH=/usr/bin/phantomjs

phantomjs version: 2.1.1

invoiceninja version: 4.5.49

OS: Ubuntu 20.04.4 LTS

php version: 7.3

Command: phantomjs test.pjs Output: \n{ "errorCode": 408, "errorString": "Network timeout on resource.", "headers": [ { "name": "Accept", "value": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" }, { "name": "User-Agent", "value": "Mozilla/5.0 (Unknown; Linux x86_64) AppleWebKit/538.1 (KHTML, like Gecko) PhantomJS/2.1.1 Safari/538.1" } ], "id": 1, "method": "GET", "time": "2022-04-22T19:42:39.241Z", "url": "https://hostname.example.com/view/mlxbfqgbtelztwntrvwc0fcxk3ulxsqb?phantomjs=true&phantomjs_secret=SECRET", "status": 408, "console": [] }

InvoiceNinja Logs: [2022-04-22T19:35:55.466938+00:00] production.ERROR: PhantomJS - Invalid response https://hostname.example.com/view/mlxbfqgbtelztwntrvwc0fcxk3ulxsqb?phantomjs=true&phantomjs_secret=SECRET: {"context":"PHP","user_id":1,"account_id":1,"user_name":"Firstname lastname","method":"GET","user_agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36","locale":"de","ip":"192.168.20.200","count":1,"is_console":"no","is_api":"no","db_server":"mysql","url":"test_headless"} []

HeyWatchOutDude avatar May 26 '22 23:05 HeyWatchOutDude

Phantom would require your instance be publicly assessible. There is no need to use Phantom with the default dockerfile as it comes prebuilt with Snappdf which generates the PDF locally.

turbo124 avatar May 26 '22 23:05 turbo124

How can I set it to "snappdf"?

HeyWatchOutDude avatar May 26 '22 23:05 HeyWatchOutDude

are you using our standard docker-compose file? it should work out of the box.

turbo124 avatar May 26 '22 23:05 turbo124

No, I'm not using docker.

I have used the following guide:

https://www.linuxbabe.com/ubuntu/install-invoiceninja-ubuntu-20-04-apache-nginx/amp

HeyWatchOutDude avatar May 27 '22 15:05 HeyWatchOutDude