Run Pa11y Dashboard on Heroku

configure puppeteer buildpack

Official Pa11y logo

Official Pa11y logo

To run Pa11y Dashboard on Heroku, you’ll need to:

  1. add puppeteer buildpack to your dyno
  2. pass --no-sandbox argument to Chrome

Puppeteer buildpack will install Chrome and all dependencies required to run it in headless mode.

Second step is only necessary if you’re going to see following error when running Pa11y tests on Heroku:

Failed to launch chrome!  No usable sandbox!
Update your kernel or see
for more information on developing with the SUID sandbox.
If you want to live dangerously and need an immediate workaround, you can try using --no-sandbox.

We like to live dangerously so let’s use that argument in config.js:

--- a/config.js
+++ b/config.js
@@ -35,7 +35,12 @@ if (fs.existsSync(jsonPath)) {
           database: env('WEBSERVICE_DATABASE', 'mongodb://localhost/pa11y-webservice'),
           host: env('WEBSERVICE_HOST', ''),
           port: Number(env('WEBSERVICE_PORT', '3000')),
-          cron: env('WEBSERVICE_CRON', false)
+          cron: env('WEBSERVICE_CRON', false),
+          chromeLaunchConfig: {
+                  "args": [
+                          "--no-sandbox"
+                  ]
+          }

Once redeployed, your tests should work without any problems.

PS. If you’d like to learn more about “No usable sandbox!” error, please have a look at: