Skip to content

Commit 7ec3327

Browse files
authored
Add heroku-22 stack support (playwright-community#20)
1 parent 77eed74 commit 7ec3327

File tree

2 files changed

+31
-3
lines changed

2 files changed

+31
-3
lines changed

README.md

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const { chromium } = require("playwright-chromium");
3131
const browser = await chromium.launch({ chromiumSandbox: false });
3232
const context = await browser.newContext();
3333
const page = await context.newPage();
34-
await page.goto('http://whatsmyuseragent.org/');
34+
await page.goto("http://whatsmyuseragent.org/");
3535
await page.screenshot({ path: `chromium.png` });
3636
await browser.close();
3737
})();
@@ -48,7 +48,7 @@ const { firefox } = require("playwright-firefox");
4848
const browser = await chromium.launch();
4949
const context = await browser.newContext();
5050
const page = await context.newPage();
51-
await page.goto('http://whatsmyuseragent.org/');
51+
await page.goto("http://whatsmyuseragent.org/");
5252
await page.screenshot({ path: `firefox.png` });
5353
await browser.close();
5454
})();
@@ -57,3 +57,25 @@ const { firefox } = require("playwright-firefox");
5757
## Best practises
5858

5959
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.
60+
61+
If you encounter this error at runtime, it means that you are missing the chromium binary, which can be installed with `playwright install chromium`.
62+
63+
```
64+
browserType.launch: Executable doesn't exist at /app/node_modules/playwright-core/.local-browsers/chromium-1012/chrome-linux/chrome
65+
╔═════════════════════════════════════════════════════════════════════════╗
66+
║ Looks like Playwright Test or Playwright was just installed or updated. ║
67+
║ Please run the following command to download new browsers: ║
68+
║ ║
69+
║ npx playwright install ║
70+
║ ║
71+
║ <3 Playwright Team ║
72+
╚═════════════════════════════════════════════════════════════════════════╝
73+
```
74+
75+
You can incorporate this into Heroku's build step by including this script in `package.json`.
76+
77+
```
78+
"scripts": {
79+
"heroku-cleanup": "yarn run playwright install [chromium | webkit | firefox]"
80+
}
81+
```

bin/compile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ install_system_deps() {
3232
if [[ "$SUPPORTED_BROWSERS" == *"chromium"* ]]; then
3333
cat << EOF >>$build_tmpdir/Aptfile
3434
# Chromium dependencies
35+
libnspr4
3536
libnss3
3637
libxss1
3738
libasound2
@@ -82,10 +83,15 @@ EOF
8283
"heroku-20")
8384
cat << EOF >>$build_tmpdir/Aptfile
8485
libvpx6
86+
EOF
87+
;;
88+
"heroku-22")
89+
cat << EOF >>$build_tmpdir/Aptfile
90+
libvpx7
8591
EOF
8692
;;
8793
*)
88-
error "STACK must be 'heroku-18' or 'heroku-20'"
94+
error "STACK must be 'heroku-18', 'heroku-20', or 'heroku-22'"
8995
esac
9096

9197
local cache_tmpdir=$(mktemp -d)

0 commit comments

Comments
 (0)