gotenberg: HTML to PDF rendering fails with 'rpc error: Printing failed (code = -32000)'

When I send a significantly large payload of HTML (about 800kb) that contains a lot of images (say ~3-4 per page, 250 pages in total) - rendering fails with the following error message:

{
    "level": "error",
    "msg": "cdp.Page: PrintToPDF: rpc error: Printing failed (code = -32000)",
    "op": "xhttp.htmlHandler: xhttp.convertSync: printer.chromePrinter.Print",
    "time": "2020-09-22T18:04:50Z",
    "trace": "s1azQwaNSYBE6zK3y5R7VhstCYbPtrix"
}

and

{
    "level": "debug",
    "msg": "[0922/180450.372244:ERROR:print_render_frame_helper.cc(1889)] Printing failed.",
    "op": "stderr.google-chrome-stable.--no-sandbox.--headless.--disable-dev-shm-usage.--font-render-hinting=none.--remote-debugging-port=9222.--disable-gpu.--disable-translate.--disable-extensions.--disable-background-networking.--safebrowsing-disable-auto-update.--disable-sync.--disable-default-apps.--hide-scrollbars.--metrics-recording-only.--mute-audio.--no-first-run",
    "time": "2020-09-22T18:04:50Z",
    "trace": "system"
}

Is there anything I can do / tweak in the environment variables to mitigate this? I’ve already increased the RPC buffer without success. System is running on AWS Fargate, 2vCPUs, 8GB of RAM.

Expected Behavior

Rendered document is returned.

Current Behavior

Rendering fails with HTTP 500.

Your Environment

  • Version used: 6.3.0
  • Operating System and version: Docker container running on AWS Fargate 2/8GB

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 15

Most upvoted comments

Thanks @sebastian-schlecht for helping out!

Yep currently there is no validation, but it could be a nice “feature” for the next version.

@STAT1C-Sy I’d like to have an issue or even better a PR about this 😄

@gulien I am closing this issue then as the original issue seems to be resolved.

@STAT1C-Sy I am not the maintainer of this repo but I guess @gulien wouldn’t mind a PR with a more descriptive error message? 😉 I think the parameters here, like the margin, are passed 1:1 to chrome for rendering without any additional validation.

Yes the problem was the margin, maybe a better error-message could help to avoid this problem? Thank you for helping me to resolve this issue.

@gulien thanks for the quick reply. I just upgraded to 6.3.1 of gotenberg and the issue seems to be gone. I’ll monitor things on our end and keep you posted. Maybe a bug inside chrome?