'Puppeteer / Playwright Heroku buildpack size restrictions

I've a Puppeteer application running on Heroku. The buildpacks I'm using are:

This application originally was within Herokus 500MB buildpack limit (originally 434MB), but recently expanded to 601.1MB. I assume this is due to change in size of Chromium.

I've updated my app, so that Chromium is included via buildpack:

and adding:

PUPPETEER_EXECUTABLE_PATH="google-chrome"
PUPPETEER_SKIP_DOWNLOAD=true

to config flags - this reduced the size of slug down to 476 MB.

I was not satisfied - this is too close to acceptable application limit. I've had a look at Playwright and set it up.

Buildpacks I'm using are:

with

PLAYWRIGHT_BUILDPACK_BROWSERS=chromium

and playwright-chromium included in package.json.

The size of slug - 474 MB.

I assume here that in Puppeteer case size of dependencies might cause the slug to exceed beyond 500MB, while in Playwright case Chromium might be an issue, as it's part of slug.

My application, written in node, uses headless browser to render PDF. While using different technologies is an option, I'd rather at this point not rewrite this setup.

As such the question is - how can I prevent my application again exceeding 500MB Heroku limits?



Solution 1:[1]

I solved it by downgrading playwright-chromium to version 1.9.1

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Daniel Nguyen