Issues with Render.js: Problems with Puppeteer and Parallel Rendering

I’m having trouble with a Node.js script (render.js) that uses Puppeteer for rendering videos and images in parallel. The script creates a renderer that generates frames based on an HTML page and then combines them into either PNG files or video files using FFmpeg. The script uses multiple worker processes to handle rendering concurrently.

You can find the code for this project on GitHub here: https://github.com/dtinth/html5-animation-video-renderer

However, I’m encountering an issue where the rendering process is not functioning as expected. Here’s an overview of the problem:

Error:
When I run the command:

node render --url="file:///D:/Desktop/airports/New%20folder/Flourish%20template_%20Bar%20chart%20race.htm" --png="D:/Desktop/airports/New%20folder/PNG_output" --no-video

I get the following error output:

Spawn worker 1
Worker 1: getInfo
render

Renders a video

Options:
  --version      Show version number                                   [boolean]
  --help         Show help                                             [boolean]
  --url          The URL to render
                                [string] [default: "file://D:DesktopNew folder
                                 (5)PNG/examples/gsap-hello-world.html?render"]
  --video        The path to video file to render. Without `--alpha` this MUST
                 be .mp4, and with `--alpha` this MUST be .mov
                                                 [string] [default: "video.mp4"]
  --parallelism  How many headless Chrome processes to use to render in parallel
                                                           [number] [default: 8]
  --start        Frame number to start rendering           [number] [default: 0]
  --end          Frame number to end rendering (that frame number will not be
                 rendered)                                              [number]
  --png          Directory for PNG frame output                         [string]
  --alpha        Renders a image/video with alpha transparency. For video, the
                 file extension MUST be .mov                           [boolean]
  --scale        Device scale factor                       [number] [default: 1]

Error: Evaluation failed: ReferenceError: getInfo is not defined
    at __puppeteer_evaluation_script__:9:22
    at ExecutionContext._evaluateInternal (D:DesktopNew folder (5)PNGnode_modulespuppeteerlibcjspuppeteercommonExecutionContext.js:175:23)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async ExecutionContext.evaluate (D:DesktopNew folder (5)PNGnode_modulespuppeteerlibcjspuppeteercommonExecutionContext.js:110:16)
    at async D:DesktopNew folder (5)PNGrender.js:21:20
    at async Object.getInfo (D:DesktopNew folder (5)PNGrender.js:48:17)
    at async work (D:DesktopNew folder (5)PNGrender.js:128:24)
    at async Object.main [as handler] (D:DesktopNew folder (5)PNGrender.js:261:20)

The error suggests that there is an issue with getInfo not being defined. However, I’m not sure why it is failing or where I should define this function.

What I’ve tried:

  • Ensuring that the getInfo function is properly defined and
    accessible.
  • Verifying that the script is correctly passing information between
    workers and handling the necessary functions.
  • Adding more logging to track down the flow of execution, but the
    issue persists.

The goal:
I want the script to render frames from the provided URL and output PNGs to the specified directory without creating a video, but it’s failing with this getInfo is not defined error.
Has anyone worked with Puppeteer and parallel rendering in Node.js and encountered similar issues? Any suggestions on how to properly define or handle the getInfo function, or how to debug this further, would be greatly appreciated!

Thanks in advance for your help!