Playwright: [BUG] Playwright cannot talk to Chromium on Heroku

Created on 27 Mar 2020  路  7Comments  路  Source: microsoft/playwright

Context:

  • Playwright Version: 0.11 and 0.12.1
  • Operating System: Ubuntu 18 on Heroku

Chromium doesn鈥檛 work with Playwright on Heroku even with the recommended puppeteer build pack that worked with Playwright 0.9. Details and discussion in #634

To reproduce, use this repo and change the Playwright version: https://github.com/diervo/testing-heroku-playwright

Most helpful comment

@mxschmitt It worked very well, I just needed to remove the playwright package and install playwright-firefox as in your example, and added your buildpack before nodejs.
Thank you so much for your help.

All 7 comments

Any updates on this? Having the same issue.

EDIT: https://github.com/microsoft/playwright/issues/2205

Make sure the --no-sandbox flag is set when running on heroku. Everything seems to be working fine on heroku with the latest version of playwright and the the build pack.

const browser = await chromium.launch({headless: true, args: ['--no-sandbox']});

Thanks for checking this @wisbell. Can you share more info on your Heroku config (e.g., which buildpack are you using)? We'd love to add it to the docs for other users.

Buildpack: https://github.com/jontewks/puppeteer-heroku-buildpack

And of course whatever nodejs buildpack heroku automatically adds.

The package.json for the library I am using has this playwright version: "playwright": "^0.15.0"

@arjun27 assigning to make sure it is in the docs and can be closed.

@Wisbell I'm doing exactly the same steps, and it's not working.
In fact the only difference is that I am using firefox, and unfortunately I need to use it.

const { firefox } = require("playwright");

  const browser = await firefox.launch({
    headless: true,
    args: ["--no-sandbox", "--disable-setuid-sandbox"],
  });

@pcborges I've created a Heroku buildpack for running Playwright including Chromium and Firefox on Heroku, let me know if it fits for your needs: https://github.com/mxschmitt/heroku-playwright-buildpack/

cc @peter @Wisbell

@mxschmitt It worked very well, I just needed to remove the playwright package and install playwright-firefox as in your example, and added your buildpack before nodejs.
Thank you so much for your help.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

saltyshiomix picture saltyshiomix  路  3Comments

JoelEinbinder picture JoelEinbinder  路  4Comments

etnbrd picture etnbrd  路  4Comments

arjunattam picture arjunattam  路  4Comments

myobie picture myobie  路  3Comments