highcharts/node-export-server

Export server is assuming list of CDN downloads which don't work on older HC versions

lukos opened this issue · 2 comments

Expected behaviour

When setting ENV HIGHCHARTS_VERSION="9.1.0", which is to create a drop-in replacement for a v2 export server, it should work as expected.

If a script is not available under a certain version, it should simply ignore it and not cause a problem. Otherwise, it should error if an unsupportable version of Highcharts is specified to make it clear that it won't work with e.g. 9.1.0

Actual behaviour

The software attempts to download a number of resources that did not exist in v9 of Highcharts, the failure of which causes the whole cache to be broken and therefore it cannot start up. Errors:

<lots of successful downloads>
2024-01-29 11:08:47 Mon Jan 29 2024 11:08:47 GMT+0000 [verbose] - [cache] Fetching script - https://code.highcharts.com/9.1.0/modules/heikinashi.js
2024-01-29 11:08:47 Mon Jan 29 2024 11:08:47 GMT+0000 [verbose] - [cache] Fetching script - https://code.highcharts.com/stock/9.1.0/indicators/indicators-all.js
2024-01-29 11:08:47 Mon Jan 29 2024 11:08:47 GMT+0000 [verbose] - [cache] Fetching script - https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.4/moment.min.js
2024-01-29 11:08:47 Mon Jan 29 2024 11:08:47 GMT+0000 [verbose] - [cache] Fetching script - https://cdnjs.cloudflare.com/ajax/libs/moment-timezone/0.5.34/moment-timezone-with-data.min.js
2024-01-29 11:08:47 Mon Jan 29 2024 11:08:47 GMT+0000 [error] - [cache] Error fetching script https://code.highcharts.com/9.1.0/modules/arc-diagram.js: 403.
2024-01-29 11:08:47 Mon Jan 29 2024 11:08:47 GMT+0000 [error] - [cache] Unable to update local Highcharts cache.
2024-01-29 11:08:47 Mon Jan 29 2024 11:08:47 GMT+0000 [verbose] - [cache] writing new manifest
2024-01-29 11:08:47 Mon Jan 29 2024 11:08:47 GMT+0000 [notice] - [browser] attempting to get a browser instance (try 0)
2024-01-29 11:08:47 Mon Jan 29 2024 11:08:47 GMT+0000 [error] - [cache] Error fetching script https://code.highcharts.com/9.1.0/modules/pictorial.js: 403.
2024-01-29 11:08:48 Mon Jan 29 2024 11:08:48 GMT+0000 [error] - [cache] Error fetching script https://code.highcharts.com/9.1.0/modules/treegraph.js: 403.
2024-01-29 11:08:48 Mon Jan 29 2024 11:08:48 GMT+0000 [error] - [cache] Error fetching script https://code.highcharts.com/9.1.0/modules/heikinashi.js: 403.
2024-01-29 11:08:48 Mon Jan 29 2024 11:08:48 GMT+0000 [error] - [cache] Error fetching script https://code.highcharts.com/9.1.0/modules/hollowcandlestick.js: 403.
2024-01-29 11:08:48 Mon Jan 29 2024 11:08:48 GMT+0000 [notice] - [pool] Initializing pool: min 4, max 8.
2024-01-29 11:08:48 Mon Jan 29 2024 11:08:48 GMT+0000 [verbose] - [pool] Attaching exit listeners to the process.
2024-01-29 11:08:48 Mon Jan 29 2024 11:08:48 GMT+0000 [error] - [pool] Error creating a new page in pool entry creation! Error: ENOENT: no such file or directory, open '/usr/local/lib/node_modules/highcharts-export-server/lib//../.cache/sources.js'
2024-01-29 11:08:48 Mon Jan 29 2024 11:08:48 GMT+0000 [error] - [pool] Error when creating worker of an event id 2: Error creating page
<lots of other errors about failing to create a pool entry>

Reproduction steps

I was using a Docker file taken from @davidseverwright in issue #451:

FROM alpine
ENV ACCEPT_HIGHCHARTS_LICENSE="YES"
ENV HIGHCHARTS_VERSION="9.1.0"
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser

RUN apk add --no-cache chromium nss freetype harfbuzz ca-certificates ttf-freefont nodejs npm dbus
RUN npm install highcharts-export-server@3.1.1 -g
EXPOSE 8080
COPY --chmod=755 entrypoint.sh healthcheck.sh /
ENTRYPOINT ["/entrypoint.sh"]

Just to be clear, there is no sources.js file under the .cache directory due to the errors. It works with version 11.2 of Highcharts so def related to the v9.1 issue.

Thanks for reporting @lukos and you're absolutely right.

I'll take care of this problem asap. I'll keep you posted here.