Tilasto
Posts: 3
Joined: Wed Dec 07, 2022 1:28 pm

phantom worker 1 unexpected data - SyntaxError: Expected token ')'

I have a Highcharts Export Server installed on two servers, one for development and one for testing. One of them sometimes throws a syntax error with the exact same input data working on the other. And sometimes repeating the same call later works when it didn't work before. Sometimes what worked before doesn't anymore.

The error message is:
[error] phantom worker 1 unexpected data - SyntaxError: Expected token ')'

Since the input data doesn't have an opening bracket '(' I don't know what could trigger this syntax error.

Searching this forum I got some hints that it might have to do with incompatible versions of the Highcharts Export Server and npm. But both servers have exactly the same versions installed. And one works and the other doesn't. And sometimes what worked before suddenly doesn't work anymore, or vice versa.

Here are the installed versions:
npm -v
7.5.2

node -v
v12.22.12

highcharts-export-server
v2.1.0

This is the log entry of the error:
phantomjs://code/worker.js:658 in loop
{"filename":"/tmp/CHART_IMAGE_C4oldq"} [object Object]
Sat Nov 19 2022 11:25:00 GMT+0100 (Central European Standard Time) [notice] phantom worker 1 - process was closed
Sun Nov 20 2022 05:34:25 GMT+0100 (Central European Standard Time) [verbose] attaching exit listeners to the process..
Sun Nov 20 2022 05:34:25 GMT+0100 (Central European Standard Time) [verbose] Pool started:
maxWorkers: 1
initialWorkers: 1
workLimit: 60
listening to process exit: true
Sun Nov 20 2022 05:34:25 GMT+0100 (Central European Standard Time) [verbose] phantom 1 - spawning worker
Sun Nov 20 2022 05:34:25 GMT+0100 (Central European Standard Time) [verbose] starting export
Sun Nov 20 2022 05:34:25 GMT+0100 (Central European Standard Time) [verbose] attempting to export from input file
Sun Nov 20 2022 05:34:25 GMT+0100 (Central European Standard Time) [verbose] phantom - received work, finding available worker
Sun Nov 20 2022 05:34:25 GMT+0100 (Central European Standard Time) [verbose] phantom - found available worker
Sun Nov 20 2022 05:34:25 GMT+0100 (Central European Standard Time) [verbose] phantom 1 - starting work
Sun Nov 20 2022 05:34:28 GMT+0100 (Central European Standard Time) [error] phantom worker 1 unexpected data - SyntaxError: Expected token ')'
And this is the content of the infile which is submitted to the Highcharts Export Server:
{"chart":{"type":"column"},"title":{"text":"Geburtenrate, pro 1000 Einwohner"},"subtitle":{"text":"Bahamas"},"legend":{"enabled":false},"exporting":{"enabled":false,"sourceWidth":1200,"sourceHeight":630},"tooltip":{"headerFormat":"","pointFormat":"<b>{point.y}<\/b><br>{series.name}<br>","valueSuffix":" Anzahl","footerFormat":"Bahamas {point.key}"},"credits":{"enabled":false},"xAxis":{"categories":["1955","1960","1965","1970","1975","1980","1985","1990","1995","2000","2005","2010","2015","2020","2025","2030","2035","2040","2045","2050","2055","2060","2065","2070","2075","2080","2085","2090","2095","2100"],"labels":{"enabled":false}},"yAxis":{"title":{"text":"Anzahl","enabled":false},"min":0,"labels":{"enabled":false}},"series":[{"name":"Geburtenrate","data":[33.7,34,33.6,26.3,27.2,24.9,27.1,24.1,23.6,20.1,15.6,15.6,14.5,14,13.5,13,12.3,11.7,11.2,10.8,10.5,10.3,10.2,10.1,10,9.9,9.8,9.8,9.7,9.7]}],"plotOptions":{"series":{"marker":{"enabled":false,"symbol":"circle","radius":2,"states":{"hover":{"enabled":true}}}}},"colors":["#384b76"],"colorAxis":{"stops":[[0,"#3d67b6"],[1,"#384b76"]],"showInLegend":false},"sources":{"Quelle":"<a class=\"m-source-layer js-member-layer\" href=\"#\">Quelle anzeigen<\/a>"}}
michal.f
Posts: 1114
Joined: Thu Aug 12, 2021 12:04 pm

Re: phantom worker 1 unexpected data - SyntaxError: Expected token ')'

Hello,

Welcome to our forum and thanks for contacting us with your question!

I've forwarded the question to our Export Server Developer and will let you know as soon as I know more.

Thanks for your patience.
Best regards!
Michał Filipiec
Highcharts Developer
https://blacklabel.pl/highcharts/
michal.f
Posts: 1114
Joined: Thu Aug 12, 2021 12:04 pm

Re: phantom worker 1 unexpected data - SyntaxError: Expected token ')'

Hi,

Due to the fact that a new version of Export server has recently been released, I would suggest testing it first, especially since there is a significant change there, which is changing PhantomJS to Puppeter.

https://github.com/highcharts/node-expo ... /puppeteer

Best regards!
Michał Filipiec
Highcharts Developer
https://blacklabel.pl/highcharts/
Tilasto
Posts: 3
Joined: Wed Dec 07, 2022 1:28 pm

Re: phantom worker 1 unexpected data - SyntaxError: Expected token ')'

Thank you for the reply!

Just to make sure I understand this right:
The version in https://github.com/highcharts/node-expo ... /puppeteer is v2.1.0. I also have v2.1.0 installed. Is the verion on Github newer anyway, although the version number has not changed to v2.1.1 or 2.2?

If I do npm update -g it does not update any Highcharts code.
michal.f
Posts: 1114
Joined: Thu Aug 12, 2021 12:04 pm

Re: phantom worker 1 unexpected data - SyntaxError: Expected token ')'

Hello,

Unfortunately, the latest version (the one I linked) is not yet on NPM, it is to appear soon, but I do not know the exact date. It will probably be marked as v3.0.0 as it is a major change.

At this point, you can clone the repository or download the zip file.

If you have any problem let me know.
Regards!
Michał Filipiec
Highcharts Developer
https://blacklabel.pl/highcharts/
Tilasto
Posts: 3
Joined: Wed Dec 07, 2022 1:28 pm

Re: phantom worker 1 unexpected data - SyntaxError: Expected token ')'

Hello,

I downloaded the newest version I could find. But it seems to be the same as the one I have already. That was at the end of December 2022 and it seems it has last been updated December 7, 2022.
Where can I find Highcharts Server 3, or the latest version that is supposed to become version 3?

Best regards
jedrzej.r
Posts: 725
Joined: Tue Jan 24, 2023 11:21 am

Re: phantom worker 1 unexpected data - SyntaxError: Expected token ')'

Hello,

In node-export-server repo on GitHub, you can see that this branch is the latest available: https://github.com/highcharts/node-expo ... /puppeteer and in package.json file it states version of repo is 3.0.0.

In order to download this particular branch, type this commands in terminal:

Code: Select all

git clone -b enhancement/puppeteer --single-branch https://github.com/highcharts/node-export-server
npm install
npm link

Let me know if this works for you.
Best regards!
Jędrzej Ruta
Highcharts Developer

Return to “Highcharts Usage”