highcharts / node-export-server

Highcharts Node.js export server
Other
353 stars 260 forks source link

Previous version output result error #540

Open cokes04 opened 2 months ago

cokes04 commented 2 months ago

Expected behaviour

Actual behaviour

image

You cannot download resources via CDN as shown in the image above. So, I added the HIGHCHARTS_MODULES environment variable excluding modules that cannot be imported as shown above and ran it again.

test However, it is output as shown in the photo above.

It worked well when I used version 11.4.3. However, due to licensing issues, you must use version 8.1.2. How can I solve this?

Reproduction steps

{
  "chart" : {
    "type" : "line",
    "borderWidth" : 1,
    "borderColor" : "#7cb5ec",
    "plotBorderWidth" : 1
  },
  "plotOptions" : {
    "line" : {
      "marker" : {
        "enabled" : true,
        "symbol" : "circle",
        "radius" : 2
      },
      "step" : false,
      "lineWidth" : 1
    }
  },
  "title" : {
    "enabled" : false,
    "style" : {
      "display" : "none"
    }
  },
  "legend" : {
    "enabled" : true,
    "verticalAlign" : "bottom",
    "padding" : 0,
    "symbolWidth" : 10,
    "itemDistance" : 5,
    "itemMarginBottom" : 0,
    "itemMarginTop" : 0,
  },
  "series" : [ {
    "name" : "test",
    "color" : "#7cb5ec",
    "data" : [ [ 1.718036262E12, 0.0 ], [ 1.718036263E12, 0.0 ], [ 1.718036264E12, 0.0 ], [ 1.718036265E12, 0.0 ], [ 1.718036266E12, 0.0 ], [ 1.718036267E12, 0.0 ], [ 1.718036268E12, 0.0 ], [ 1.718036269E12, 0.0 ], [ 1.71803627E12, 0.0 ], [ 1.718036272E12, 0.0 ], [ 1.718036273E12, 0.0 ], [ 1.718036274E12, 0.0 ], [ 1.718036275E12, 0.0 ], [ 1.718036276E12, 0.0 ], [ 1.718036277E12, 0.0 ], [ 1.718036278E12, 0.0 ], [ 1.718036279E12, 0.0 ], [ 1.71803628E12, 0.0 ], [ 1.718036281E12, 0.0 ], [ 1.718036282E12, 57.98 ], [ 1.718039307E12, 0.0 ], [ 1.718039308E12, 151.39 ], [ 1.718039309E12, 0.0 ], [ 1.71803931E12, 0.0 ], [ 1.718039311E12, 0.0 ], [ 1.718039312E12, 0.0 ], [ 1.718039313E12, 0.0 ], [ 1.718039314E12, 0.0 ], [ 1.718039316E12, 0.0 ], [ 1.718039317E12, 0.0 ], [ 1.718039318E12, 0.0 ], [ 1.718039319E12, 0.0 ], [ 1.71803932E12, 0.0 ], [ 1.718039321E12, 0.0 ], [ 1.718039322E12, 0.0 ], [ 1.718039323E12, 0.0 ], [ 1.718039324E12, 0.0 ], [ 1.718039325E12, 0.0 ], [ 1.718039326E12, 0.0 ], [ 1.718039327E12, 0.0 ], [ 1.718039328E12, 108.84 ], [ 1.718039329E12, 0.0 ], [ 1.71803933E12, 0.0 ], [ 1.718039331E12, 0.0 ], [ 1.718039332E12, 0.0 ], [ 1.718039333E12, 0.0 ], [ 1.718039334E12, 0.0 ], [ 1.718039335E12, 0.0 ], [ 1.718039336E12, 0.0 ], [ 1.718039337E12, 0.0 ], [ 1.718039338E12, 0.0 ], [ 1.718039339E12, 0.0 ], [ 1.71803934E12, 0.0 ], [ 1.718039341E12, 0.0 ], [ 1.718039342E12, 0.0 ], [ 1.718039343E12, 0.0 ], [ 1.718039344E12, 0.0 ], [ 1.718039345E12, 0.0 ], [ 1.718039346E12, 0.0 ], [ 1.718039347E12, 23.03 ], [ 1.718039348E12, 0.0 ], [ 1.718039349E12, 0.0 ], [ 1.71803935E12, 0.0 ], [ 1.718039351E12, 0.0 ], [ 1.718039352E12, 0.0 ], [ 1.718039353E12, 0.0 ], [ 1.718039354E12, 0.0 ], [ 1.718039355E12, 0.0 ], [ 1.718039356E12, 0.0 ], [ 1.718039357E12, 0.0 ], [ 1.718039358E12, 0.0 ], [ 1.718039359E12, 0.0 ], [ 1.71803936E12, 0.0 ], [ 1.718039361E12, 0.0 ], [ 1.718039362E12, 0.0 ], [ 1.718039363E12, 0.0 ], [ 1.718039718E12, 0.0 ], [ 1.718039719E12, 0.0 ], [ 1.71803972E12, 0.0 ], [ 1.718039721E12, 0.0 ], [ 1.718039722E12, 0.0 ], [ 1.718039723E12, 0.0 ], [ 1.718039724E12, 0.0 ], [ 1.718039725E12, 0.0 ], [ 1.718039726E12, 0.0 ], [ 1.718039727E12, 0.0 ], [ 1.718039728E12, 1.11 ], [ 1.718039729E12, 0.0 ], [ 1.71803973E12, 0.0 ], [ 1.718039731E12, 0.0 ], [ 1.718039732E12, 0.0 ], [ 1.718039733E12, 0.0 ], [ 1.718039734E12, 0.0 ], [ 1.718039735E12, 0.0 ], [ 1.718039736E12, 0.0 ], [ 1.718039737E12, 0.0 ], [ 1.718039738E12, 0.0 ], [ 1.718039739E12, 0.0 ], [ 1.71803974E12, 0.0 ], [ 1.718039741E12, 0.0 ], [ 1.718039742E12, 0.0 ], [ 1.718039743E12, 0.0 ], [ 1.718039744E12, 0.0 ], [ 1.718039745E12, 0.0 ], [ 1.718039746E12, 0.0 ], [ 1.718039747E12, 0.0 ], [ 1.718039749E12, 735.74 ], [ 1.718039751E12, 0.0 ], [ 1.718039752E12, 0.0 ], [ 1.718039753E12, 0.0 ], [ 1.718039754E12, 0.0 ], [ 1.718039755E12, 0.0 ], [ 1.718039756E12, 0.0 ], [ 1.718039757E12, 0.0 ], [ 1.718039758E12, 0.0 ], [ 1.718039759E12, 0.0 ], [ 1.71803976E12, 0.0 ], [ 1.718039761E12, 0.0 ], [ 1.718039762E12, 0.0 ], [ 1.718039763E12, 0.0 ], [ 1.718039764E12, 0.0 ], [ 1.718039765E12, 0.0 ], [ 1.718039766E12, 0.0 ], [ 1.718039767E12, 0.0 ], [ 1.718039768E12, 78.75 ], [ 1.718039769E12, 0.0 ], [ 1.71803977E12, 0.0 ], [ 1.718039771E12, 0.0 ], [ 1.718039772E12, 0.0 ], [ 1.718039773E12, 0.0 ], [ 1.718039774E12, 0.0 ], [ 1.718039775E12, 0.0 ], [ 1.718039776E12, 0.0 ], [ 1.718039777E12, 0.0 ], [ 1.718039778E12, 0.0 ], [ 1.718039779E12, 0.0 ], [ 1.71803978E12, 0.0 ], [ 1.718039781E12, 0.0 ], [ 1.718039782E12, 0.0 ], [ 1.718039783E12, 0.0 ], [ 1.718039784E12, 0.0 ], [ 1.718039785E12, 0.0 ], [ 1.718039786E12, 0.0 ], [ 1.718039787E12, 0.0 ], [ 1.718039788E12, 190.31 ], [ 1.718039789E12, 0.0 ], [ 1.71803979E12, 0.0 ], [ 1.718039791E12, 0.0 ], [ 1.718039793E12, 0.0 ], [ 1.718039794E12, 0.0 ], [ 1.718039795E12, 0.0 ], [ 1.718039796E12, 0.0 ], [ 1.718039797E12, 0.0 ], [ 1.718039798E12, 0.0 ], [ 1.718039799E12, 0.0 ], [ 1.7180398E12, 0.0 ], [ 1.718039801E12, 0.0 ], [ 1.718039802E12, 0.0 ], [ 1.718039803E12, 0.0 ], [ 1.718039804E12, 0.0 ], [ 1.718039805E12, 0.0 ], [ 1.718039806E12, 0.0 ], [ 1.718039807E12, 0.0 ], [ 1.718039808E12, 0.0 ], [ 1.718039809E12, 0.0 ], [ 1.71803981E12, 0.0 ], [ 1.718039811E12, 0.0 ], [ 1.718039812E12, 0.0 ], [ 1.718039813E12, 0.0 ], [ 1.718039814E12, 0.0 ], [ 1.718039815E12, 0.0 ], [ 1.718039816E12, 0.0 ], [ 1.718039817E12, 0.0 ], [ 1.718040103E12, 0.0 ], [ 1.718040104E12, 0.0 ], [ 1.718040105E12, 0.0 ], [ 1.718040106E12, 0.0 ], [ 1.718040107E12, 0.0 ], [ 1.718040108E12, 0.0 ], [ 1.718040109E12, 143.28 ], [ 1.71804011E12, 0.0 ], [ 1.718040111E12, 0.0 ], [ 1.718040112E12, 0.0 ], [ 1.718040113E12, 0.0 ], [ 1.718040114E12, 0.0 ], [ 1.718040115E12, 0.0 ], [ 1.718040116E12, 0.0 ], [ 1.718040117E12, 0.0 ], [ 1.718040118E12, 0.0 ], [ 1.718040119E12, 0.0 ], [ 1.71804012E12, 0.0 ], [ 1.718040121E12, 0.0 ], [ 1.718040122E12, 0.0 ], [ 1.718040123E12, 0.0 ], [ 1.718040124E12, 0.0 ], [ 1.718040125E12, 0.0 ], [ 1.718040126E12, 0.0 ], [ 1.718040127E12, 0.0 ], [ 1.718040128E12, 0.0 ], [ 1.718040129E12, 8.53 ], [ 1.71804013E12, 0.0 ], [ 1.718040131E12, 0.0 ], [ 1.718040132E12, 0.0 ], [ 1.718040133E12, 0.0 ], [ 1.718040134E12, 0.0 ], [ 1.718040135E12, 0.0 ], [ 1.718040136E12, 0.0 ], [ 1.718040137E12, 0.0 ], [ 1.718040138E12, 0.0 ], [ 1.718040139E12, 0.0 ], [ 1.71804014E12, 0.0 ], [ 1.718040141E12, 0.0 ], [ 1.718040142E12, 0.0 ], [ 1.718040143E12, 0.0 ], [ 1.718040144E12, 0.0 ], [ 1.718040145E12, 0.0 ], [ 1.718040146E12, 0.0 ], [ 1.718040147E12, 0.0 ], [ 1.718040148E12, 0.0 ], [ 1.718040149E12, 151.73 ], [ 1.71804015E12, 0.0 ], [ 1.718040151E12, 0.0 ], [ 1.718040152E12, 0.0 ] ]
  } ],
  "credits" : {
    "enabled" : false
  },
  "yAxis" : {
    "type" : "linear",
    "title" : {
      "enabled" : false,
      "style" : {
        "display" : "none"
      }
    },
    "maxPadding" : 0
  },
  "xAxis" : {
    "type" : "datetime",
    "labels" : {
      "formatter" : function() {
const timestamp = Math.trunc(this.value);
return Highcharts.dateFormat('%H:%M:%S:%L', timestamp) + String((this.value % 1 * 1000).toFixed(0)).padStart(3, '0');
}
    },
    "tickPositions" : [ 1718036260462, 1718037233632, 1718038206803, 1718039179974, 1718040153145 ],
    "min" : 1718036260462,
    "max" : 1718040153145
  }
}
jszuminski commented 2 months ago

Thanks for reporting @cokes04!

So, I added the HIGHCHARTS_MODULES environment variable excluding modules that cannot be imported

Definitely that's the right approach here. Unfortunately, I don't think I can see the second image that you've attached - it seems to be all black. Could you please try attaching it again (or maybe sending an imgur link)?

Also, please share steps of installation/setting up your server.

PS. It might be worth trying to clone the current master branch from GitHub (highcharts-export-server@4.0.0) - the latest version has been drastically improved compared to v3.1.1. Highcharts modules loading from CDN is also something that we were improving in this version so it may have even solved this issue. Please try it out and let me know.

daddyg commented 2 months ago

I'm also seeing this issue when trying to run the server with the V6.2.0 version of highcharts specified. It seems to be failing when the server starts up and tries to cache the scripts locally. I suspect that what is happening is that all modules are being requested, but the newer modules that didn't exist in version 6.2.0 are all returning a 403 from the CDN, and this means that the process does not cache the rest of the source code.

[error] - [cache] Error fetching script https://code.highcharts.com/6.2.0/modules/funnel3d.js: 403.
[error] - [cache] Error fetching script https://code.highcharts.com/6.2.0/modules/treegraph.js: 403.
[error] - [cache] Error fetching script https://code.highcharts.com/6.2.0/modules/timeline.js: 403.
[error] - [cache] Error fetching script https://code.highcharts.com/6.2.0/modules/networkgraph.js: 403.
[error] - [cache] Error fetching script https://code.highcharts.com/6.2.0/modules/pictorial.js: 403.
[error] - [cache] Error fetching script https://code.highcharts.com/6.2.0/modules/sonification.js: 403.
[error] - [cache] Error fetching script https://code.highcharts.com/6.2.0/modules/price-indicator.js: 403.
[error] - [cache] Error fetching script https://code.highcharts.com/6.2.0/modules/arc-diagram.js: 403.
[error] - [cache] Error fetching script https://code.highcharts.com/6.2.0/modules/stock-tools.js: 403.
[error] - [cache] Error fetching script https://code.highcharts.com/6.2.0/modules/dependency-wheel.js: 403.
[error] - [cache] Error fetching script https://code.highcharts.com/6.2.0/modules/hollowcandlestick.js: 403.
[error] - [cache] Error fetching script https://code.highcharts.com/6.2.0/modules/cylinder.js: 403.
[error] - [cache] Error fetching script https://code.highcharts.com/stock/6.2.0/indicators/indicators-all.js: 403.
[error] - [cache] Error fetching script https://code.highcharts.com/6.2.0/modules/heikinashi.js: 403.
[error] - [cache] Error fetching script https://code.highcharts.com/6.2.0/modules/organization.js: 403.
[error] - [cache] Error fetching script https://code.highcharts.com/6.2.0/modules/dotplot.js: 403.
[error] - [cache] Error fetching script https://code.highcharts.com/6.2.0/modules/marker-clusters.js: 403.
[error] - [cache] Error fetching script https://code.highcharts.com/6.2.0/modules/pyramid3d.js: 403.
[error] - [cache] Error fetching script https://code.highcharts.com/6.2.0/modules/lollipop.js: 403.
[error] - [cache] Error fetching script https://code.highcharts.com/6.2.0/modules/venn.js: 403.
[error] - [cache] Error fetching script https://code.highcharts.com/6.2.0/modules/dumbbell.js: 403.
[error] - [cache] Error fetching script https://code.highcharts.com/6.2.0/modules/debugger.js: 403.
[error] - [cache] Unable to update local Highcharts cache
[verbose] - [cache] writing new manifes
[notice] - [browser] attempting to get a browser instance (try 0)
[notice] - [pool] Initializing pool: min 4, max 8.
[verbose] - [pool] Attaching exit listeners to the process.
[error] - [pool] Error creating a new page in pool entry creation! Error: ENOENT: no such file or directory, open '/var/app/current/node_modules/highcharts-export-server/lib//../.cache/sources.js'

I have also been trying to set what modules and indicators to download and I have had some success, but I still can't get the server working.

Firstly, I suspect the documentation might be wrong on the github readme. It states that the environment variables should be HIGHCHARTS_MODULE_SCRIPTS and HIGHCHARTS_INDICATOR_SCRIPTS however the npm readme shows HIGHCHARTS_MODULES and HIGHCHARTS_INDICATORS.

Using HIGHCHARTS_MODULES I was able to specify which modules to load, and this stopped the 403 errors displaying in the logs. Unfortunately I haven't been able to stop the loading of indicators-all.js and so I still get one 403 which breaks the setup process.

I have tried setting both HIGHCHARTS_INDICATOR_SCRIPTS and HIGHCHARTS_INDICATORS to an empty string, but this does not work. I am trying setting the value to [] now, we will see what happens.

daddyg commented 2 months ago

So when setting the following env variable:

HIGHCHARTS_INDICATORS=[]

I get the following error in the logs:

[verbose] - [cache] Fetching script - https://code.highcharts.com/stock/6.2.0/indicators/[].js

This tells me that I have the correct environment variable, but when using an empty string in the variable then it still tries to load the indicators-all.js

HIGHCHARTS_INDICATORS=

Results in:

[error] - [cache] Error fetching script https://code.highcharts.com/stock/6.2.0/indicators/indicators-all.js: 403.

So I can't see a way to get V6.2.0 working, is anyone able to help on this?

cokes04 commented 2 months ago

@jszuminski

The attached image was not attached incorrectly, but was uploaded as is the image file output by export-server.

I am performing an export by running a cli through Java. Therefore, import-server and nodejs are installed and used from the java image as shown below. Of course, the same incorrect image file is output on Windows OS as well.

I have not set anything other than the settings below.

I considered using 4.0.0 by git clone, but It was put on hold because an error like https://github.com/highcharts/node-export-server/issues/543 occurred. (ERR_REQUIRE_ESM)

ENV JAVA_OPTS='' ENV HIGHCHARTS_VERSION='8.1.2'

ENV HIGHCHARTS_MODULES='stock,map,gantt,exporting,export-data,parallel-coordinates,accessibility,annotations-advanced,boost-canvas,boost,data,draggable-points,\ static-scale,broken-axis,heatmap,tilemap,timeline,treemap,item-series,drilldown,histogram-bellcurve,bullet,funnel,funnel3d,\ pyramid3d,networkgraph,pareto,pattern-fill,price-indicator,sankey,dependency-wheel,series-label,solid-gauge,sonification,\ stock-tools,streamgraph,sunburst,variable-pie,variwide,vector,venn,windbarb,wordcloud,xrange,no-data-to-display,drag-panes,\ debugger,dumbbell,lollipop,cylinder,organization,dotplot,marker-clusters'

nodejs, highcharts-export-server install

RUN apt-get update \ && apt-get install -y curl \ && curl -sL https://deb.nodesource.com/setup_18.x | bash - \ && apt-get install -y nodejs \ && curl -L https://www.npmjs.com/install.sh | sh \ && npm install -g highcharts-export-server@3.1.1

chrome install

RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb \ && apt-get install -y ./google-chrome-stable_current_amd64.deb \ && rm google-chrome-stable_current_amd64.deb

ENTRYPOINT java ${JAVA_OPTS} -jar /home/exporttest/test.jar


* window
```batch
npm install highcharts-export-server@3.1.1 -g

setx HIGHCHARTS_VERSION 9.3.2

setx HIGHCHARTS_MODULES stock,map,gantt,exporting,export-data,parallel-coordinates,accessibility,annotations-advanced,boost-canvas,boost,data,draggable-points,^
static-scale,broken-axis,heatmap,tilemap,timeline,treemap,item-series,drilldown,histogram-bellcurve,bullet,funnel,funnel3d,^
pyramid3d,networkgraph,pareto,pattern-fill,price-indicator,sankey,dependency-wheel,series-label,solid-gauge,sonification,^
stock-tools,streamgraph,sunburst,variable-pie,variwide,vector,venn,windbarb,wordcloud,xrange,no-data-to-display,drag-panes,^
debugger,dumbbell,lollipop,cylinder,organization,dotplot,marker-clusters
cokes04 commented 2 months ago

@jszuminski

Additionally, in 4.0.0, has the part where the process does not terminate after export completion been fixed?

jszuminski commented 2 months ago

@cokes04 yes, it has been fixed.