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

RangeError: toPrecision() argument must be between 1 and 100

Open malteschlueter opened this issue 7 months ago • 3 comments

Hello people,

I'm currently try to setup the server with Docker.

Error Message when try the example test curl request: curl -H "Content-Type: application/json" -X POST -d '{"infile":{"title": {"text": "Chart"}, "xAxis": {"categories": ["Jan", "Feb", "Mar"]}, "series": [{"data": [29.9, 71.5, 106.4]}]}}' 127.0.0.1:7801:

highcharts-export-server-1  | Tue May 06 2025 13:15:34 GMT+0000 [verbose] - [export] Got an incoming HTTP request with ID 05520c7efe38433785a289f6a7fb6ceb.
highcharts-export-server-1  | Tue May 06 2025 13:15:34 GMT+0000 [verbose] - [chart] Starting the exporting process.
highcharts-export-server-1  | Tue May 06 2025 13:15:34 GMT+0000 [verbose] - [chart] Attempting to export from a raw input.
highcharts-export-server-1  | Tue May 06 2025 13:15:34 GMT+0000 [verbose] - [pool] Work received, starting to process.
highcharts-export-server-1  | Tue May 06 2025 13:15:34 GMT+0000 [verbose] - [pool] Acquiring a worker handle.
highcharts-export-server-1  | Tue May 06 2025 13:15:34 GMT+0000 [verbose] - [pool] Acquired a worker handle.
highcharts-export-server-1  | Tue May 06 2025 13:15:34 GMT+0000 [verbose] - [pool] Starting work on pool entry with ID c048d55b-c456-4b80-8d7a-1550f76b44b7.
highcharts-export-server-1  | Tue May 06 2025 13:15:34 GMT+0000 [verbose] - [export] Determining export path.
highcharts-export-server-1  | Tue May 06 2025 13:15:34 GMT+0000 [verbose] - [export] Treating as config.
highcharts-export-server-1  | Tue May 06 2025 13:15:34 GMT+0000 [verbose] - [export] The current total size of data passed to a page is around 0.00 MB
highcharts-export-server-1  | Tue May 06 2025 13:15:34 GMT+0000 [error] - [pool] In pool.postWork: For request with ID 05520c7efe38433785a289f6a7fb6ceb - Error encountered during export: 30.137292ms. 
highcharts-export-server-1  |  RangeError: toPrecision() argument must be between 1 and 100
highcharts-export-server-1  |     at triggerExport (evaluate at setAsConfig (file:///home/pptruser/node_modules/highcharts-export-server/lib/export.js:157:15), <anonymous>:94:20)
highcharts-export-server-1  |     at #evaluate (file:///home/pptruser/node_modules/puppeteer-core/lib/esm/puppeteer/cdp/ExecutionContext.js:383:19)
highcharts-export-server-1  |     at async ExecutionContext.evaluate (file:///home/pptruser/node_modules/puppeteer-core/lib/esm/puppeteer/cdp/ExecutionContext.js:270:16)
highcharts-export-server-1  |     at async IsolatedWorld.evaluate (file:///home/pptruser/node_modules/puppeteer-core/lib/esm/puppeteer/cdp/IsolatedWorld.js:96:16)
highcharts-export-server-1  |     at async CdpFrame.evaluate (file:///home/pptruser/node_modules/puppeteer-core/lib/esm/puppeteer/api/Frame.js:335:20)
highcharts-export-server-1  |     at async CdpPage.evaluate (file:///home/pptruser/node_modules/puppeteer-core/lib/esm/puppeteer/api/Page.js:799:20)
highcharts-export-server-1  |     at async default (file:///home/pptruser/node_modules/highcharts-export-server/lib/export.js:224:9)
highcharts-export-server-1  |     at async postWork (file:///home/pptruser/node_modules/highcharts-export-server/lib/pool.js:328:20)
highcharts-export-server-1  |     at async doExport (file:///home/pptruser/node_modules/highcharts-export-server/lib/chart.js:438:20)
highcharts-export-server-1  |     at async exportHandler (file:///home/pptruser/node_modules/highcharts-export-server/lib/server/routes/export.js:225:5)
highcharts-export-server-1  | Tue May 06 2025 13:15:34 GMT+0000 [verbose] - [pool] Releasing a worker with ID c048d55b-c456-4b80-8d7a-1550f76b44b7. Clear page status: true.

I'm already tried different Node versions and HighChart versions but always I've got the toPrecision error but I can't find anything in this direction. I've also tried google-chrome-stable.

Has somebody an idea?

Dockerfile:

FROM node:22

ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
ENV PUPPETEER_EXECUTABLE_PATH /usr/bin/chromium
ENV HIGHCHARTS_VERSION=11

RUN apt-get update \
    && apt-get install -y chromium \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

COPY ./deploy/highcharts/fonts/ /usr/share/fonts/truetype/

RUN fc-cache -fv

RUN groupadd -r pptruser && useradd -r -g pptruser pptruser \
    && mkdir -p /home/pptruser/Downloads \
    && chown -R pptruser:pptruser /home/pptruser

USER pptruser

WORKDIR /home/pptruser

RUN npm install highcharts-export-server

EXPOSE 7801

ENTRYPOINT ["node", "/home/pptruser/node_modules/highcharts-export-server/bin/cli.js", "--enableServer", "1"]

malteschlueter avatar May 06 '25 13:05 malteschlueter

Maybe it is just coincidence but we run into the same error when we tried to run image built for linux/amd64 on arm processor.

paukert avatar May 06 '25 17:05 paukert

It's good point. I've created a new Ubuntu 24 instance and installed Docker and used the Dockerfile (installed additionally chromium-sandbox but now I got another error. I've already tried the suggestions on the mentioned url but without any success.

[17:17:0506/213726.892519:ERROR:content/browser/zygote_host/zygote_host_impl_linux.cc:132] No usable sandbox! If this is a Debian system, please install the chromium-sandbox package to solve this problem. If you are running on Ubuntu 23.10+ or another Linux distro that has disabled unprivileged user namespaces with AppArmor, see https://chromium.googlesource.com/chromium/src/+/main/docs/security/apparmor-userns-restrictions.md. If you want to live dangerously and need an immediate workaround, you can try using --no-sandbox.

malteschlueter avatar May 06 '25 21:05 malteschlueter

Hello, I'm hitting the same issue here. Exactly same dockerfile, runs on amd64 but fails with this same error on arm64.

robertof-surveypal avatar Aug 14 '25 05:08 robertof-surveypal