- Automatically installs Playwright and required browser dependencies
- Allows you to specify which browsers to install (chromium, firefox, webkit)
- Supports headless or non-headless mode
- Lets you specify the Playwright version, or auto-detects it
- Installs only the dependencies needed for the selected browsers to optimize build time and image size
This extension only affects the build and deploy process, not the
dev command.Options
-
browsers: Array of browsers to install. Valid values:"chromium","firefox","webkit". Default:["chromium"]. -
headless: Run browsers in headless mode. Default:true. If set tofalse, a virtual display (Xvfb) will be set up automatically. -
version: Playwright version to install. If not provided, the version will be auto-detected from your dependencies (recommended).
Custom browsers and version
Headless mode
By default, browsers are run in headless mode. If you need to run browsers with a UI (for example, for debugging), setheadless: false. This will automatically set up a virtual display using Xvfb.
Environment variables
The extension sets the following environment variables during the build:PLAYWRIGHT_BROWSERS_PATH: Set to/ms-playwrightso Playwright finds the installed browsersPLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: Set to1to skip browser download at runtimePLAYWRIGHT_SKIP_BROWSER_VALIDATION: Set to1to skip browser validation at runtimeDISPLAY: Set to:99ifheadless: false(for Xvfb)
Troubleshooting
Browser download failures
If you encounter errors during the build process related to browser downloads (e.g., “failed to solve: process did not complete successfully: exit code: 9”), this is a known issue with certain Playwright versions. Workaround: Revert Playwright to version1.40.0 in your project dependencies. You can specify this version explicitly in your config:
Managing browser instances
To prevent issues with waits and resumes, you can use middleware and locals to manage the browser instance. This will ensure the browser is available for the whole run, and is properly cleaned up on waits, resumes, and after the run completes. Here’s an example usingchromium, but you can adapt it for other browsers:
getBrowser() in your task’s run function to access the browser instance:

