Skip to content

playwright-community/heroku-playwright-example

master
Switch branches/tags
Code

Latest commit

Bumps [ws](https://github.com/websockets/ws) from 7.4.3 to 7.4.6.
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](websockets/ws@7.4.3...7.4.6)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
00bb303

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
src
 
 
 
 
 
 
 
 
 
 

Heroku Playwright Example

This example demonstrates how to use Playwright with Chromium and Firefox on a Heroku environment.

Deploy

General

The setup is based on using the Playwright Heroku Buildpack which installs the necessary dependencies and adjusts the needed Playwright specific settings. It's required to run this before using the NodeJS Buildpack, because otherwise the NPM dependencies won't be installed correctly.

Components

In this minimal setup, we are using an Express web server, which accepts requests with the browser name and the URL as parameters. This demonstrates, that the setup works during the normal Dyno runtime. For a full reference, you can find the HTTP handler in the src/index.js file. It's important to run Chromium with the chromiumSandbox: false flag, because Heroku has no usable sandbox functionality on their containers.

To see a live demonstration, you can checkout heroku.playwright.tech or make requests to these URLs to see that a browser is launched, the specified URL is opened and a screenshot is taken and delivered to the user:

Best practises

It's common to only install the browser-specific NPM packages, 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.