Error when processing render request 18 Timeout when executing in phantom Error: Timeout when executing in phantom-pdf
-
Am able to get pdf response data with generated barcode using the API call (In postman) ,
OS : Windows 10But While using docker in google cloud getting this error
Error when processing render request 18 Timeout when executing in phantom Error: Timeout when executing in phantom at Timeout._onTimeout (/app/node_modules/phantom-html-to-pdf/lib/dedicatedProcessStrategy.js:89:26) at ontimeout (timers.js:427:11) at tryOnTimeout (timers.js:289:5) at unrefdHandle (timers.js:511:7) at Timer.processTimers (timers.js:211:12)
//api payload { "template": { "shortid": "_QdTf8r5TB", "recipe": "phantom-pdf", "engine": "handlebars", "phantom":{ "waitForJS":true, "printDelay":900 } } }
Below sample code
// Generate barcode in html template <html> <head> <script src="https://code.jquery.com/jquery-2.1.3.min.js"></script> <script src="https://cdn.jsdelivr.net/jsbarcode/3.3.20/JsBarcode.all.min.js"></script> <script> setTimeout(function() { JsBarcode("#code128", 'test123'); window.JSREPORT_READY_TO_START = true; //this will start the pdf printing }, 900); </script> </head> <body> <svg id="code128"></svg> </body> </html>
//jsreport.config.json { "httpPort": 8080, "store": { "provider": "postgres" }, "reportTimeout": 600000, "extensions": { "phantom": { "numberOfWorkers": 1, "timeout": 600000, "allowLocalFilesAccess": false, "defaultPhantomjsVersion": "1.9.8" }, "express": { "renderTimeout": 600000 } }, "logger": { "console": { "transport": "console", "level": "debug" }, "file": { "transport": "file", "level": "info", "filename": "logs/reporter.log" }, "error": { "transport": "file", "level": "error", "filename": "logs/error.log" } }, "allowLocalFilesAccess": true, "templatingEngines": { "strategy": "http-server" }, "chrome": { "timeout": 40000 } }
-
Event I tried in playground.jsreport.net api call
Error
<html><head>
<title>504 Gateway Time-out</title>
</head><body bgcolor="white">
<center>
<h1>504 Gateway Time-out</h1>
</center>
<hr>
<center>nginx/1.13.12</center>
</body></html>
-
The troubleshooting can be done in this case by removing the flag "wait for printing trigger" and run with the debug button. You would see the output:
+42 Error code: 202. Description: Error downloading https://cdn.jsdelivr.net/jsbarcode/3.3.20/JsBarcode.all.min.js - server replied: Forbidden
For some reason the cdn server refuses to server the js file to the phantomjs.
What you can do is download the file manually and add it as an asset to your workspace.
See this working here
https://playground.jsreport.net/w/anon/cXe7XPjIHowever... What is the reason to use phantom-pdf?
I strongly recommend to use chrome-pdf instead, you wouldn't see this problem there.
-
yea! that asset file load works for me, Thanks a lot @jan_blaha