Handle very large emails (>5 MB) in PDF conversion

A small number of emails carry pathologically large HTML bodies (e.g. 5–7 MB — usually huge embedded/inline content). The PDF renderer (Puppeteer) times out on these even after retries, so they end up pdf_status='failed' and the file finishes as partial rather than completed.

Observed in production on a 1,143-email mailbox: 1,141 converted fine, 2 emails (~5 MB and ~7 MB HTML) timed out. This is a pre-existing pdf-service limit, surfaced now that conversion runs on the durable worker and reports status honestly.

Options to explore:

  • Strip/normalise more aggressively before render (we already strip oversized base64 image data-URIs; extend to other large inline content).
  • Raise the per-email render timeout for known-large payloads, or render large emails on a dedicated slower path.
  • Fall back to a simplified/text-only PDF for emails that exceed a size threshold instead of failing them.

Goal: a huge email should still produce a PDF (even a simplified one) so files reach completed, not partial.

Please authenticate to join the conversation.

Upvoters
Status

In Review

Board
💡

Feature Request

Date

About 6 hours ago

Author

Harry Elliott

Subscribe to post

Get notified by email when there are changes.