My app is working on localhost but when i deploy on heroku this module is required for puppeteer app https://github.com/jontewks/puppeteer-heroku-buildpack. puppeteer node_module size is around 300mb and this module size is 200.Total size is 539mb. Please suggest a good solution
-
Hi, did you find the solution to this problem? I'm also facing it; couldn't resolve yet. – Haseeb Sep 16 '22 at 10:45
-
@Haseeb nope. I deployed the app on Google app engine – Adnan Hassan Sep 17 '22 at 11:25
-
cool thank you, anyway I found the solution to use the Playwright instead. It reduces the bundle size greatly. Here is the guide (if anyone is looking for solution): https://stackoverflow.com/a/69481396/12824406 – Haseeb Sep 18 '22 at 12:13
1 Answers
Faced the same issue.
The following steps reduced my slug size from around 530MB to around 250MB.
1 — Update buildpacks
Add the heroku/google-chrome
buildpack. Place it above the heroku/nodejs
buildpack. The jontewks/puppeteer-heroku-buildpack
is not required here anymore.
2 — Add new ENV variables
Add PUPPETEER_EXECUTABLE_PATH. In your local environment, set this env variable as \path\to\chrome.exe
. In Heroku, set this env variable as google-chrome
.
Also add PUPPETEER_SKIP_DOWNLOAD, and set it to true
. This tells Puppeteer to skip downloading Chromium.
3 — Update Puppeteer config
Puppeteer's launch options includes executablePath
. Set this to PUPPETEER_EXECUTABLE_PATH.
4 — Deploy, you're done!
Push commit to Heroku to trigger new deployment. Hopefully, your slug size will have reduced by then, and your Heroku app should be able to deploy successfully.

- 461
- 5
- 17
-
1This was very helpful for me! My project's slug size went from ~490mb down to ~290mb. Thank you! – The Traveling Coder Mar 08 '23 at 21:55
-
1Seriously! Went from 499.2 to 286. I was also stuck on Puppeteer 18. Thank you so much! – Petercopter May 23 '23 at 17:23