KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

PhantomJs errors with "ReferenceError: Can't find variable: KoolReport" #1516

Open Julian Griffiths opened this topic on on Jul 6, 2020 - 1 comments

Julian Griffiths commented on Jul 6, 2020

Hi When I try to export my reports to PDF, I get the following errors from phantomJs. I have re-run the same command that is being run in Handler.php @line 64

Cmd run:

/var/www/html/wp-content/plugins/medaid/lib/composer/koolreport/export/bin/phantomjs --ignore-ssl-errors=true /var/www/html/wp-content/plugins/medaid/lib/composer/koolreport/export/pdf/pdf.js /tmp/5f0399c76fb625.tmp /tmp/5f0399c76fbe06.pdf eyJmb3JtYXQiOiJBNCIsIm9yaWVudGF0aW9uIjoicG9ydHJhaXQiLCJleHBlY3RlZExvY2F0aW9uIjoiaHR0cHM6XC9cL2Jpb21lZC1xYS5tZWRhaWQuY28udWtcL3JlcG9ydHNcLz9ycHRfdG9rZW5fcGRmPTJkMzM5MmJlZDQ1NGVmNTRkNTA3OGExZTE5ZTIwZmJkIiwicmVzb3VyY2VXYWl0aW5nIjoxMDAwfQ==
Output:

  https://xxxxxxxx/reports/?rpt_token_pdf=2d3392bed454ef54d5078a1e19e20fbd:73 in global code
ReferenceError: Can't find variable: KoolReport

  https://xxxxxxxxxxxx/reports/?rpt_token_pdf=2d3392bed454ef54d5078a1e19e20fbd:78 in global code
ReferenceError: Can't find variable: KoolReport

  https://xxxxxxxxxxx/?rpt_token_pdf=2d3392bed454ef54d5078a1e19e20fbd:83 in global code
ReferenceError: Can't find variable: KoolReport

  https://xxxxxxxxxxxx/reports/?rpt_token_pdf=2d3392bed454ef54d5078a1e19e20fbd:89 in global code
1;/tmp/5f0399c76fbe06.pdf

Any input on this would be appreciated - thanks

Julian Griffiths commented on Jul 7, 2020

I have managed to fix this - and for anyone who has the same issue - here is what my problem was.

  1. this worked fine on my dev environment (Mac with 2 dockers (webserver and database). Running only http
  2. deployed to test environment (identical webserver docker and database docker, BUT with an Nginx docker frontend that terminates HTTPS and proxies HTTP to backend webserver

This is where my problem lies. The webserver only provides HTTP, so when PhantomJS tries to get HTTPS locally it fails. I have had to force my local connections out to the internet and back into the Nginx proxy. Another possibility is to parse the html that is being fed to to PhantomJs and replace all local HTTPS with HTTP OR to open up HTTPS on my webserver.- not tried that yet - but at least I have found the issue.

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
solved

Export