node-export-server icon indicating copy to clipboard operation
node-export-server copied to clipboard

Cannot find module "sunburst"

Open WillForrestMindBridge opened this issue 9 months ago • 1 comments

Affected node export version: 4.0.2, 5.0.0

Highcharts versions tested with node export server: 10.3.3 , 11.1.0

Problem:

When exporting a sunburst chart, the module for sunburst.js is not found, even though it has been cached by highcharts export server.

Stack trace:

2025-03-21 16:43:54 Fri Mar 21 2025 16:43:54 GMT-0400 [verbose] - [export] Got an incoming HTTP request with ID e9b408bef8674c6391ae689c861ed6c5.
2025-03-21 16:43:54 Fri Mar 21 2025 16:43:54 GMT-0400 [verbose] - [chart] Starting the exporting process.
2025-03-21 16:43:54 Fri Mar 21 2025 16:43:54 GMT-0400 [verbose] - [chart] Attempting to export from a raw input.
2025-03-21 16:43:54 Fri Mar 21 2025 16:43:54 GMT-0400 [verbose] - [pool] Work received, starting to process.
2025-03-21 16:43:54 Fri Mar 21 2025 16:43:54 GMT-0400 [verbose] - [pool] Acquiring a worker handle.
2025-03-21 16:43:54 Fri Mar 21 2025 16:43:54 GMT-0400 [verbose] - [pool] Acquired a worker handle.
2025-03-21 16:43:54 Fri Mar 21 2025 16:43:54 GMT-0400 [verbose] - [pool] Starting work on pool entry with ID c9ce3b2a-8610-4986-b50f-3c6956778b97.
2025-03-21 16:43:54 Fri Mar 21 2025 16:43:54 GMT-0400 [verbose] - [export] Determining export path.
2025-03-21 16:43:54 Fri Mar 21 2025 16:43:54 GMT-0400 [verbose] - [export] Treating as config.
2025-03-21 16:43:54 Fri Mar 21 2025 16:43:54 GMT-0400 [error] - [pool] In pool.postWork: For request with ID e9b408bef8674c6391ae689c861ed6c5 - Error encountered during export: 53.387667ms. 
2025-03-21 16:43:54  Error: Highcharts error #17: www.highcharts.com/errors/17/?missingModuleFor=sunburst
2025-03-21 16:43:54  - missingModuleFor: sunburst
2025-03-21 16:43:54     at triggerExport (evaluate at setAsConfig (file:///app/node_modules/highcharts-export-server/lib/export.js:138:8), <anonymous>:91:46)
2025-03-21 16:43:54     at #evaluate (file:///app/node_modules/puppeteer-core/lib/esm/puppeteer/cdp/ExecutionContext.js:383:19)
2025-03-21 16:43:54     at async ExecutionContext.evaluate (file:///app/node_modules/puppeteer-core/lib/esm/puppeteer/cdp/ExecutionContext.js:270:16)
2025-03-21 16:43:54     at async IsolatedWorld.evaluate (file:///app/node_modules/puppeteer-core/lib/esm/puppeteer/cdp/IsolatedWorld.js:96:16)
2025-03-21 16:43:54     at async CdpFrame.evaluate (file:///app/node_modules/puppeteer-core/lib/esm/puppeteer/api/Frame.js:335:20)
2025-03-21 16:43:54     at async CdpPage.evaluate (file:///app/node_modules/puppeteer-core/lib/esm/puppeteer/api/Page.js:799:20)
2025-03-21 16:43:54     at async default (file:///app/node_modules/highcharts-export-server/lib/export.js:204:9)
2025-03-21 16:43:54     at async postWork (file:///app/node_modules/highcharts-export-server/lib/pool.js:307:20)
2025-03-21 16:43:54     at async doExport (file:///app/node_modules/highcharts-export-server/lib/chart.js:439:20)
2025-03-21 16:43:54     at async exportHandler (file:///app/node_modules/highcharts-export-server/lib/server/routes/export.js:212:5)

Indications that this is a node export bug:

  • The manifest file (node_modules/highcharts-export-server/.cache/manifest.json) has sunburst listed:
{"version":"11.1.0","modules":{"highcharts":1,"highcharts-more":1,"highcharts-3d":1,"exporting":1,"price-indicator":1,"draggable-points":1,"export-data":1,"hollowcandlestick":1,"xrange":1,"timeline":1,"sankey":1,"gantt":1,"treemap":1,"windbarb":1,"drilldown":1,"boost-canvas":1,"series-label":1,"pyramid3d":1,"marker-clusters":1,"sunburst":1,"item-series":1,"funnel":1,"treegraph":1,"arc-diagram":1,"heikinashi":1,"vector":1,"solid-gauge":1,"tilemap":1,"series-on-point":1,"networkgraph":1,"stock":1,"lollipop":1,"variable-pie":1,"debugger":1,"data":1,"bullet":1,"overlapping-datalabels":1,"static-scale":1,"parallel-coordinates":1,"cylinder":1,"pattern-fill":1,"dependency-wheel":1,"heatmap":1,"pareto":1,"dotplot":1,"variwide":1,"boost":1,"organization":1,"drag-panes":1,"broken-axis":1,"streamgraph":1,"histogram-bellcurve":1,"funnel3d":1,"no-data-to-display":1,"wordcloud":1,"sonification":1,"dumbbell":1,"venn":1,"accessibility":1,"indicators-all":1}}
  • The sources.js file in the .cache has the source code for sunburst, and mapping comment is present
//# sourceMappingURL=sunburst.js.map
  • The module list is given via a .env file as outlined in the readme.
HIGHCHARTS_VERSION=11.1.0
HIGHCHARTS_CORE_SCRIPTS=highcharts,highcharts-more,highcharts-3d
HIGHCHARTS_MODULE_SCRIPTS=price-indicator, exporting, draggable-points, export-data, hollowcandlestick, xrange, timeline, sankey, gantt, treemap, windbarb, drilldown, boost-canvas, series-label, pyramid3d, marker-clusters, sunburst, item-series, funnel, treegraph, arc-diagram, heikinashi, vector, solid-gauge, tilemap, series-on-point, networkgraph, stock, lollipop, variable-pie, debugger, data, bullet, overlapping-datalabels, static-scale, parallel-coordinates, cylinder, pattern-fill, dependency-wheel, heatmap, pareto, dotplot, variwide, boost, organization, drag-panes, broken-axis, streamgraph, histogram-bellcurve, funnel3d, no-data-to-display, wordcloud, sonification, dumbbell, venn, accessibility
HIGHCHARTS_INDICATOR_SCRIPTS=indicators-all

The standard charts such as stock charts, bar and line charts etc seem to function fine, it's just sunburst that seems to have a module issue at the moment.

Minimum postman payload to have the error occur:

{
    "infile": {
        "chart": {
            "type": "sunburst"
        },
        "title": {
            "text": "Minimal Sunburst Chart"
        },
        "series": [
            {
                "type": "sunburst",
                "data": [
                    {
                        "id": "root",
                        "name": "Root"
                    },
                    {
                        "id": "A",
                        "name": "Category A",
                        "parent": "root"
                    },
                    {
                        "id": "B",
                        "name": "Category B",
                        "parent": "root"
                    },
                    {
                        "id": "A1",
                        "name": "Subcategory A1",
                        "parent": "A",
                        "value": 5
                    }
                ]
            }
        ]
    }
}

This payload works on the older phantomJS export server.

Has anyone else had issues with sunburst charts?

Update / Workaround

I've found that commenting out all the .env variables, and re-downloading the modules on every boot fixes this problem.

This is however problematic, as we use highcharts in a cloud environment, which can have many containers running it.

Using the module list to cache the modules prevented many GET calls to highcharts.

WillForrestMindBridge avatar Mar 25 '25 14:03 WillForrestMindBridge

I've figured it out.

The HIGHCHARTS_MODULE_SCRIPTS loads the modules in the order that they are input. Using the manifest.json in the .cache is tricky, any mistakes in order can be a problem.

Apparently, some modules don't load unless their dependent modules are loaded first. This leads to the failure to load the sunburst module.

The correct order of modules for 11.1.0 is:

stock, map, gantt, exporting, parallel-coordinates, accessibility, boost-canvas, boost, data, data-tools, draggable-points, static-scale, broken-axis, heatmap, tilemap, tiledwebmap, timeline, treemap, treegraph, item-series, drilldown, histogram-bellcurve, bullet, funnel, funnel3d, geoheatmap, pyramid3d, networkgraph, overlapping-datalabels, pareto, pattern-fill, pictorial, price-indicator, sankey, arc-diagram, dependency-wheel, series-label, series-on-point, solid-guage, sonification, streamgraph, sunburst, variable-pie, variwide, vector, venn, windbarb, windcloud, xrange, no-data-to-display, drag-panes, debugger, dumbbell, lollipop, cylinder, organization, dotplot, marker-clusters, hallowcandlestick, heikinashi, flowmap, export-data, navigator, textpath

Could this behaviour at least be documented?

WillForrestMindBridge avatar Mar 25 '25 18:03 WillForrestMindBridge

Hi @WillForrestMindBridge,

Of course, the order in which modules are loaded matters, just like in a browser when displaying Highcharts charts (since it works the same way under the hood on the server). Regarding the documentation, there is a section that mentions this:

The format, along with its default values, is as follows (using the recommended ordering of core and module scripts below)

So, when modifying script options, make sure the modules are in the correct order.

PaulDalek avatar Jun 02 '25 13:06 PaulDalek