Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
jontewks committed Aug 9, 2022
1 parent e0fb630 commit 5b4aaff
Showing 1 changed file with 35 additions and 3 deletions.
38 changes: 35 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# puppeteer-heroku-buildpack

Installs dependencies needed in order to run puppeteer on heroku. Be sure to include `{ args: ['--no-sandbox'] }` in your call to `puppeteer.launch`.
Installs dependencies needed in order to run puppeteer on heroku. Be sure to include `{ args: ['--no-sandbox'] }` in your call to `puppeteer.launch`.

Puppeteer defaults to `headless: true` in `puppeteer.launch` and this shouldn't be changed. Heroku doesn't have a GUI to show you chrome when running `headless: false` and Heroku will throw an error.

Expand All @@ -14,17 +14,49 @@ To use the latest stable version run:
$ heroku buildpacks:add jontewks/puppeteer
```

Or use the source code in this repository:
The tags in this buildpack are now tied to Heroku stacks that they install dependencies for. The latest at the moment is Heroku-22. This buildpack's tag 22.0.0 is just the dependencies for Heroku-22. This will allow the smallest slug sizes and quickest build times for each stack when we aren't installing any unnecessary dependencies.

To use a specific version (Heroku-22 stack version in this case):

```sh-session
$ heroku buildpacks:add https://github.com/jontewks/puppeteer-heroku-buildpack.git
$ heroku buildpacks:add https://github.com/jontewks/puppeteer-heroku-buildpack#22.0.0
```

### Additional language support

If you need support for Japanese, Chinese, or Korean fonts, a fork of this buildpack has been made to include those as well: https://github.com/CoffeeAndCode/puppeteer-heroku-buildpack

## Issues

#### Caching

A common issue that people run into often is a cache issue with heroku. Often when you start seeing errors that chrome won't start and some libraries are missing, you can resolve it by clearing your heroku cache. Instructions for that can be found here: https://help.heroku.com/18PI5RSY/how-do-i-clear-the-build-cache

#### Slug Size

A common issue is running into slug size maximums when using this buildpack. Unfortunately the chromium bundled with Puppeteer requires some packages to be installed on Heroku that are quite large. The list of common missing requirements on Debian for Puppeteer can be found here: https://pptr.dev/troubleshooting, and the list of available packages on each Heroku stack by default can be found here: https://devcenter.heroku.com/articles/stack-packages#installed-ubuntu-packages. This buildpack only installs things in the first list that aren't found in the second list and their sizes are as follows:
| Package | Size (mb) |
| ------- | ---- |
| `fonts-liberation` | 2.1 |
| `libappindicator3-1` | 55.2 |
| `libasound2` | 2.4 |
| `libatk-bridge2.0-0` | 3.9 |
| `libatk1.0-0` | 0.2 |
| `libgbm1` | 0.4 |
| `libgtk-3-0` | 54.8 |
| `libnspr4` | 0.3 |
| `libnss3` | 4.2 |
| `libx11-xcb1` | 0.1 |
| `libxcomposite1` | 0.03 |
| `libxcursor1` | 0.1 |
| `libxdamage1` | 0.03 |
| `libxfixes3` | 0.05 |
| `libxi6` | 0.1 |
| `libxrandr2` | 0.07 |
| `libxss1` | 0.03 |
| `libxtst6` | 0.05 |
| `xdg-utils` | 344 😱 |

Some of these are quite large but unfortunately there is nothing we can do about it at the moment.

If you are still running into any issues with this buildpack after doing the above, please open an issue on this repo and/or submit a PR that resolves it. Different versions of chrome have different dependencies and so some issues can creep in without me knowing. Thanks!

0 comments on commit 5b4aaff

Please sign in to comment.