Skip to content
This repository was archived by the owner on Sep 11, 2025. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
# Heroku Playwright Buildpack

This buildpack installs all the needed dependencies to use Playwright with Chromium and Firefox on Heroku.
This buildpack installs all of the necessary dependencies to use Playwright with Chromium and Firefox on Heroku.

[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/mxschmitt/heroku-playwright-example)

## Usage

For using this buildpack, you have to add the buildpack **before** installing your Node.js dependencies.
To use this buildpack, you must add the buildpack **before** installing your Node.js dependencies.

```txt
heroku buildpacks:set https://github.com/mxschmitt/heroku-playwright-buildpack.git -a my-app
```

For a full example, see [here](https://github.com/mxschmitt/heroku-playwright-example) a usage with the Express library.
For a full example, see [here](https://github.com/mxschmitt/heroku-playwright-example).

It's common to use the `PLAYWRIGHT_BUILDPACK_BROWSERS` environment variable which accepts a comma-separated list of the browser names (`chromium`, `firefox`, `webkit`). By default, it's installing the dependencies for all the browsers. To only install Chromium dependencies for example, just set it to `chromium`. This will reduce the slug size in the end too.
It's common to use the `PLAYWRIGHT_BUILDPACK_BROWSERS` environment variable, which accepts a comma-separated list of the browser names (`chromium`, `firefox`, `webkit`). By default, it installs the dependencies for all of the browsers. To only install Chromium dependencies, for example, just set it to `chromium`. This approach will reduce the slug size.

You should also install the browser specific NPM packages like `playwright-chromium.` to reduce the slug size.
You should also install the browser-specific NPM packages like `playwright-chromium` to reduce the slug size.

## Examples

### Chromium

For using Chromium, it's **necessary** to use `chromiumSandbox: false` in the launch options, since on Heroku is no support for the Chromium sandbox.
To use Chromium, it's **necessary** to use `chromiumSandbox: false` in the launch options because Heroku does not support the Chromium sandbox.

```javascript
const { chromium } = require("playwright-chromium");
Expand All @@ -39,7 +39,7 @@ const { chromium } = require("playwright-chromium");

### Firefox

For Firefox, you can refer to the official examples, no need to adjust any configurations.
For Firefox, you can refer to the official examples; no need to adjust any configurations.

```javascript
const { firefox } = require("playwright-firefox");
Expand All @@ -54,9 +54,9 @@ const { firefox } = require("playwright-firefox");
})();
```

## Best practises
## Best practices

It's common to only install the [browser-specific NPM packages](https://playwright.dev/#version=v1.1.1&path=docs%2Finstallation.md&q=download-single-browser-binary), which will reduce installation time and slug size on Heroku in the end, that should fix also the error that the slug size is too large.
It's common to only install the [browser-specific NPM packages](https://playwright.dev/#version=v1.1.1&path=docs%2Finstallation.md&q=download-single-browser-binary), which will reduce installation time and slug size on Heroku in the end. It should reduce the slug size.

If you encounter this error at runtime, it means that you are missing the chromium binary, which can be installed with `playwright install chromium`.

Expand All @@ -72,7 +72,7 @@ browserType.launch: Executable doesn't exist at /app/node_modules/playwright-cor
╚═════════════════════════════════════════════════════════════════════════╝
```

You can incorporate this into Heroku's build step by including this script in `package.json`.
You can incorporate it into Heroku's build step by including this script in the `package.json` file.

```
"scripts": {
Expand Down