I had an apps to use phantomjs to generate a report by using Google Charts.
The apps will spawn a child process to execute phantomjs command, to load a web page that contains the charts, and then take a screenshots saving into JPG, which later convert into PDF for archive.
In the code, it needs to load the following JS URL from Google: https://www.google.com/jsapi, which is HTTPS based.
Suddenly it is stopped working since last month.
By checking the log and found that PhantomJS encountered JavaScript error: “ReferenceError, can’t find Google”. Hey, I tried to open the web page in my local Chrome browser, and it still working. I tried to CuRL from my server, still can download the page. So I suspected might be SSL issues on PhantomJS.
Tried googling and found a solution. As Google had already deprecated the old version of SSL (SSLv3) and use TLSv1.
In the command line, we need to add one more option: –ssl-protocol=tlsv1, to bypass the HTTPS error, and it turns out it is working now.
phantomjs --ssl-protocol=tlsv1 your-code.js