For our web application, we use Highcharts to render beautiful charts. Some charts are reused multiple times across the website, so we decided to prerender them via highcharts/node-export-server. Due to operational reasons, it is hosted inside a Windows Service via Azure/iisnode. This process works reasonably well. However, we noticed, that there are errors logged, although the charts seem to be rendered just fine:
1 [error] phantom worker 2 error - SetProcessDpiAwareness failed: "COM error 0x80070005 (Unknown error 0x0ffffffff80070005)"
Investigation of the Error
Naturally, we wanted to find the cause of this error, if there are some issues we should be aware of and if there is anything we could do to avoid it.
Resolving the Error
Pass flag to PhantomJS
However, there seems to be a way around this issue. According the issue, it is possible to pass
-platform windows:dpiawareness=0 to PhantomJS. So can we actually configure this, since the phantomjs process is spawned by the node-export-server? The actual call happens in
1 2 // https://github.com/highcharts/node-export-server/blob/2.0.16/lib/phantompool.js worker.process = phantomjs.exec(settings.worker, (__dirname + '/../'));
There is no way to configure additional options, so we are out of luck here.
There seems to be some additional way to work around this issue via the Windows Registry or Windows Policies, but I wasn’t able to find out the specifics. If you have more luck on this front, please let me know.
Another possibility would be to fork the node-export-server repository on GitHub and implement the desired functionality. However, this would cause additional overhead and it seems unlikely, that this would be merged back into the main repository. Since it seems that the engineers from Highcharts are thinking about moving to a different headless browser like Chrome (with its rather new headless mode). However, there doesn’t seem to be a clear path or timeline yet. Follow the issue #57 on GitHub for further updates.
In the end, we decided to live with these errors for now, as there doesn’t seem to be any problem with the chart generation itself. Workarounds would require further development and testing resources which are currently not available.