Closed jovstern closed 1 year ago
Could you please provide more information on how you export these charts?
In my Node app I first started the Phantom in the main page:
const chartExporter = require('highcharts-export-server');
chartExporter.initPool();
Then I run the exporter with some configuration of the chart:
chartExporter.export(exportSettings, (error, chart) => {
if (!error) {
return chart;
}
}));
And if that not enough I run the service globally just like the example in the instruction, also didn't work.
As I mention, I use this service for some time and everything worked fine until (I guess) I reinstalled the package.
Tnx.
I'm facing a relative issue
The Server is run in a Docker Container which pulls a Node Image with the version 14.7 and installs the Server with npm. The server runs in a docker compose environment besides PHP and nginx Container. The node container is linked to the PHP container.
For testing purposes the example curl is used
curl -H "Content-Type: application/json" -X POST -d '{"infile":{"title": {"text": "Steep Chart"}, "xAxis": {"categories": ["Jan", "Feb", "Mar"]}, "series": [{"data": [29.9, 71.5, 106.4]}]}}' 127.0.0.1:7801 -o mychart.png
The Request is sent via shell_execute
. The Export server receives the request and responds
[error] phantom worker 3 unexpected data - ReferenceError: Can't find variable: Intl
node_1 |
node_1 | undefined:108
node_1 | :83 in P
node_1 | :108
node_1 | :83
node_1 | {"data":"iVBORw0KGgoAAAANS......="} {
node_1 | data: {
node_1 | allowCodeExecution: false,
node_1 | width: false,
node_1 | callback: false,
node_1 | resources: false,
node_1 | scale: 1,
node_1 | constr: undefined,
node_1 | chart: {
node_1 | title: [Object],
node_1 | xAxis: [Object],
node_1 | series: [Array],
node_1 | chart: [Object],
node_1 | exporting: [Object]
node_1 | },
node_1 | svgstr: undefined,
node_1 | format: 'png',
node_1 | out: 'tmp/chart.af648cca071b435cbf386b60a5060da2.png',
node_1 | styledMode: false,
node_1 | asyncRendering: false,
node_1 | async: false,
node_1 | reqID: 'af648cca071b435cbf386b60a5060da2',
node_1 | globalOptions: false,
node_1 | themeOptions: 'false',
node_1 | customCode: false,
node_1 | dataOptions: false,
node_1 | id: 3
node_1 | },
node_1 | working: true,
node_1 | ready: false,
node_1 | alive: true,
node_1 | process: <ref *1> ChildProcess {
node_1 | _events: [Object: null prototype] {
node_1 | uncaughtException: [Function (anonymous)],
node_1 | error: [Function (anonymous)],
node_1 | close: [Function (anonymous)]
node_1 | },
node_1 | _eventsCount: 3,
node_1 | _maxListeners: undefined,
node_1 | _closesNeeded: 3,
node_1 | _closesGot: 0,
node_1 | connected: false,
node_1 | signalCode: null,
node_1 | exitCode: null,
node_1 | killed: false,
node_1 | spawnfile: '/usr/local/lib/node_modules/highcharts-export-server/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs',
node_1 | _handle: Process {
node_1 | onexit: [Function (anonymous)],
node_1 | pid: 14,
node_1 | [Symbol(owner_symbol)]: [Circular *1]
node_1 | },
node_1 | spawnargs: [
node_1 | '/usr/local/lib/node_modules/highcharts-export-server/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs',
node_1 | '/usr/local/lib/node_modules/highcharts-export-server/lib/../phantom/worker.js',
node_1 | '/usr/local/lib/node_modules/highcharts-export-server/lib/../'
node_1 | ],
node_1 | pid: 14,
node_1 | stdin: Socket {
node_1 | connecting: false,
node_1 | _hadError: false,
node_1 | _parent: null,
node_1 | _host: null,
node_1 | _readableState: [ReadableState],
node_1 | _events: [Object: null prototype],
node_1 | _eventsCount: 1,
node_1 | _maxListeners: undefined,
node_1 | _writableState: [WritableState],
node_1 | allowHalfOpen: false,
node_1 | _sockname: null,
node_1 | _pendingData: null,
node_1 | _pendingEncoding: '',
node_1 | server: null,
node_1 | _server: null,
node_1 | [Symbol(async_id_symbol)]: 19,
node_1 | [Symbol(kHandle)]: [Pipe],
node_1 | [Symbol(kSetNoDelay)]: false,
node_1 | [Symbol(lastWriteQueueSize)]: 0,
node_1 | [Symbol(timeout)]: null,
node_1 | [Symbol(kBuffer)]: null,
node_1 | [Symbol(kBufferCb)]: null,
node_1 | [Symbol(kBufferGen)]: null,
node_1 | [Symbol(kCapture)]: false,
node_1 | [Symbol(kBytesRead)]: 0,
node_1 | [Symbol(kBytesWritten)]: 0
node_1 | },
node_1 | stdout: Socket {
node_1 | connecting: false,
node_1 | _hadError: false,
node_1 | _parent: null,
node_1 | _host: null,
node_1 | _readableState: [ReadableState],
node_1 | _events: [Object: null prototype],
node_1 | _eventsCount: 3,
node_1 | _maxListeners: undefined,
node_1 | _writableState: [WritableState],
node_1 | allowHalfOpen: false,
node_1 | _sockname: null,
node_1 | _pendingData: null,
node_1 | _pendingEncoding: '',
node_1 | server: null,
node_1 | _server: null,
node_1 | [Symbol(async_id_symbol)]: 20,
node_1 | [Symbol(kHandle)]: [Pipe],
node_1 | [Symbol(kSetNoDelay)]: false,
node_1 | [Symbol(lastWriteQueueSize)]: 0,
node_1 | [Symbol(timeout)]: null,
node_1 | [Symbol(kBuffer)]: null,
node_1 | [Symbol(kBufferCb)]: null,
node_1 | [Symbol(kBufferGen)]: null,
node_1 | [Symbol(kCapture)]: false,
node_1 | [Symbol(kBytesRead)]: 0,
node_1 | [Symbol(kBytesWritten)]: 0
node_1 | },
node_1 | stderr: Socket {
node_1 | connecting: false,
node_1 | _hadError: false,
node_1 | _parent: null,
node_1 | _host: null,
node_1 | _readableState: [ReadableState],
node_1 | _events: [Object: null prototype],
node_1 | _eventsCount: 3,
node_1 | _maxListeners: undefined,
node_1 | _writableState: [WritableState],
node_1 | allowHalfOpen: false,
node_1 | _sockname: null,
node_1 | _pendingData: null,
node_1 | _pendingEncoding: '',
node_1 | server: null,
node_1 | _server: null,
node_1 | [Symbol(async_id_symbol)]: 21,
node_1 | [Symbol(kHandle)]: [Pipe],
node_1 | [Symbol(kSetNoDelay)]: false,
node_1 | [Symbol(lastWriteQueueSize)]: 0,
node_1 | [Symbol(timeout)]: null,
node_1 | [Symbol(kBuffer)]: null,
node_1 | [Symbol(kBufferCb)]: null,
node_1 | [Symbol(kBufferGen)]: null,
node_1 | [Symbol(kCapture)]: false,
node_1 | [Symbol(kBytesRead)]: 0,
node_1 | [Symbol(kBytesWritten)]: 0
node_1 | },
node_1 | stdio: [ [Socket], [Socket], [Socket] ],
node_1 | [Symbol(kCapture)]: false
node_1 | },
node_1 | workStartTime: 1628772845096,
node_1 | ondone: [Function (anonymous)],
node_1 | workcount: 7,
node_1 | incoming: "ReferenceError: Can't find variable: Intl\n" +
node_1 | '\n' +
node_1 | ' undefined:108\n' +
node_1 | ' :83 in P\n' +
node_1 | ' :108\n' +
node_1 | ' :83\n' +
100 233 100 96 100 137 44 63 0:00:02 0:00:02 --:--:-- 108
[error] work af648cca071b435cbf386b60a5060da2 could not be completed, sending:
an error occured when rendering the chart: SyntaxError: Unexpected token R in JSON at position 0
It has been tried to install intl and jquery via npm but it doesn't change the reference error
Thank you
In my Node app I first started the Phantom in the main page:
const chartExporter = require('highcharts-export-server'); chartExporter.initPool();
Then I run the exporter with some configuration of the chart:
chartExporter.export(exportSettings, (error, chart) => { if (!error) { return chart; } }));
And if that not enough I run the service globally just like the example in the instruction, also didn't work.
As I mention, I use this service for some time and everything worked fine until (I guess) I reinstalled the package.
Tnx.
@jovstern while installing highcharts-export-server npm, it prompts to install highchart version, use 8.2.2 I solved this issue using this. May Be this help Thanks
Closing due to inactivity.
I encourage you to try out our latest Puppeteer-based version of the Export Server (here’s a short setup guide: https://github.com/highcharts/node-export-server#puppeteer-version-information) where this should no longer be a problem.
If this issue still persists in the newest version, please report it again so we can investigate it.
When trying to export any image from the service you get this error:
When you decode the string in the data (base 64) you get black image. This behaviour happens when installing highcharts-export-server globally and also as a Node module locally.
I guess one of the npm packges that the service uses has changed because we came across with this issue after we reinstall the highcharts-export-server again.
We test it on Mac, Linux and windows with Node 14/16 with the last highcharts-export-server version.
Thank you.