heroku-playwright-buildpack icon indicating copy to clipboard operation
heroku-playwright-buildpack copied to clipboard

Doesn't working properly on Heroku

Open matheuschimelli opened this issue 3 years ago • 12 comments

First I would like to thank you for this buildback.

I would like to report a bug that i found when i was trying to deploy the heroku-playwright-buildback. Some important infos:

  • Node v17.6.0
  • Npm v8.5.1
  • Running on Heroku I'm using Typescript as well.

What's happening is that when i deploy heroku-playwright-buildback it doensn't work. However when i use the puppeteer buildpack https://github.com/jontewks/puppeteer-heroku-buildpack.git my app works.

I'm suspecting there is a bug but I don't know where it is.

browserType.launch: Executable doesn't exist at /app/node_modules/playwright-chromium/node_modules/playwright-core/.local-browsers/chromium-973391/chrome-linux/chrome
╔═════════════════════════════════════════════════════════════════════════╗
║ Looks like Playwright Test or Playwright was just installed or updated. ║
║ Please run the following command to download new browsers:              ║
║                                                                         ║
║     npx playwright install                                              ║
║                                                                         ║
║ <3 Playwright Team                                                      ║
╚═════════════════════════════════════════════════════════════════════════╝
    at playwrightCrawler (/app/dist/lib/crawler-base.js:12:58)
    at default_1 (/app/dist/jobs/crawlers/crawler-tjpr-diary/sandbox.js:11:97)
    at processor (/app/node_modules/bull/lib/process/master.js:69:50)
    at /app/node_modules/bull/lib/process/master.js:91:33
    at process.<anonymous> (/app/node_modules/bull/lib/process/master.js:109:9)
    at processEmit [as emit] (/app/node_modules/signal-exit/index.js:175:34)

matheuschimelli avatar Feb 27 '22 14:02 matheuschimelli

Same issue here. @matheuschimelli are you using yarn? i found that the demo broke when using yarn as that is what we are trying to get to work on our end.

@mxschmitt any thoughts on how to get the demo/buildpack to work with yarn?

bauerjon avatar Feb 28 '22 22:02 bauerjon

Same issue here. @matheuschimelli are you using yarn? i found that the demo broke when using yarn as that is what we are trying to get to work on our end.

@mxschmitt any thoughts on how to get the demo/buildpack to work with yarn?

Yes. I'm using Yarn. However, i also tried with npm and i got that error.

matheuschimelli avatar Feb 28 '22 23:02 matheuschimelli

@matheuschimelli I found that it wasn't related to yarn but the newer version of "playwright-chromium" (or similar).

try hardcoding your package.json value for "playwright-chromium" or similar to 1.15.0. the newer versions seem to have a dependency called "playwright-core" which don't seem to play nicely with the build pack as far as I can tell

bauerjon avatar Mar 01 '22 00:03 bauerjon

@matheuschimelli I found that it wasn't related to yarn but the newer version of "playwright-chromium" (or similar).

try hardcoding your package.json value for "playwright-chromium" or similar to 1.15.0. the newer versions seem to have a dependency called "playwright-core" which don't seem to play nicely with the build pack as far as I can tell

Interesting. Thanks for the tip. I will try it later.

I'm using https://github.com/jontewks/puppeteer-heroku-buildpack.git with playwright and it works like a charm as well.

matheuschimelli avatar Mar 01 '22 02:03 matheuschimelli

Hey guys, so was very frustated at this problem as I had it too, am using Yarn. I followed your advice, downgraded to 1.15.0 and it works, thanks. Hopefully a proper fix can be found some time.

ZeroByter avatar Mar 02 '22 21:03 ZeroByter

Hey guys, so was very frustated at this problem as I had it too, am using Yarn. I followed your advice, downgraded to 1.15.0 and it works, thanks. Hopefully a proper fix can be found some time.

Yes this is sad! But i have hope that one day everything will be better and all of us that are facing issues will have everlast happiness.

matheuschimelli avatar Mar 02 '22 22:03 matheuschimelli

This just bit us after we upgraded our playwright-chromium package from 1.13 to 1.21. Glad this thread was here to point the way and hope this gets fixed soon.

amy-mac avatar Apr 29 '22 22:04 amy-mac

Is there any way to make this work using playwright-python??

hbtalha avatar Jun 19 '22 06:06 hbtalha

Hi, trying to bring this issue back to light.

Using the Python version of Playwright and it seems to compile successfully heroku_build_log.txt

But getting this in the logs

2022-07-17T22:52:42.235763+00:00 app[web.1]:   File "/app/downloader.py", line 33, in scrapePage

2022-07-17T22:52:42.235763+00:00 app[web.1]:     browser = await p.chromium.launch(

2022-07-17T22:52:42.235763+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.10/site-packages/playwright/async_api/_generated.py", line 11399, in launch

2022-07-17T22:52:42.235764+00:00 app[web.1]:     await self._impl_obj.launch(

2022-07-17T22:52:42.235764+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.10/site-packages/playwright/_impl/_browser_type.py", line 93, in launch

2022-07-17T22:52:42.235766+00:00 app[web.1]:     Browser, from_channel(await self._channel.send("launch", params))

2022-07-17T22:52:42.235766+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.10/site-packages/playwright/_impl/_connection.py", line 43, in send

2022-07-17T22:52:42.235767+00:00 app[web.1]:     return await self._connection.wrap_api_call(

2022-07-17T22:52:42.235767+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.10/site-packages/playwright/_impl/_connection.py", line 370, in _

2022-07-17T22:52:42.235767+00:00 app[web.1]:     return await result

2022-07-17T22:52:42.235768+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.10/site-packages/playwright/_impl/_connection.py", line 78, in inner_send

2022-07-17T22:52:42.235768+00:00 app[web.1]:     result = next(iter(done)).result()

2022-07-17T22:52:42.235769+00:00 app[web.1]: playwright._impl._api_types.Error: Executable doesn't exist at /app/.heroku/python/lib/python3.10/site-packages/playwright/driver/package/.local-browsers/chromium-1012/chrome-linux/chrome

2022-07-17T22:52:42.235769+00:00 app[web.1]: ╔════════════════════════════════════════════════════════════╗

2022-07-17T22:52:42.235770+00:00 app[web.1]: ║ Looks like Playwright was just installed or updated.       ║

2022-07-17T22:52:42.235770+00:00 app[web.1]: ║ Please run the following command to download new browsers: ║

2022-07-17T22:52:42.235771+00:00 app[web.1]: ║                                                            ║

2022-07-17T22:52:42.235771+00:00 app[web.1]: ║     playwright install                                     ║

2022-07-17T22:52:42.235771+00:00 app[web.1]: ║                                                            ║

2022-07-17T22:52:42.235772+00:00 app[web.1]: ║ <3 Playwright Team                                         ║

2022-07-17T22:52:42.235772+00:00 app[web.1]: ╚════════════════════════════════════════════════════════════╝

zibdie avatar Jul 17 '22 22:07 zibdie

I also have this issue - I've worked on this for 2 days straight and can't seem to solve it.

I've tried to specify a specific verion:

 npm i [email protected]

I've also tried using a different buildpack

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

I've ensured that these buildpacks come before the heroku/nodejs one.

The issue I cannot seem to navigate is:

browserType.launch: Executable doesn't exist at /app/.cache/ms-playwright/chromium-1019/chrome-linux/chrome

image

app.json

{
  "buildpacks": [{ "url": "heroku/nodejs" }],

  "environments": {
    "test": {
      "stack": "heroku-20",
      "addons": ["heroku-postgresql:in-dyno"],
      "buildpacks": [
        { "url": "https://github.com/mxschmitt/heroku-playwright-buildpack" },
        { "url": "heroku/nodejs" }
      ],
      "scripts": {
        "test": "npx playwright test"
      }
    }
  }
}

I also have a playwright.config.ts setup from the playwright init command.

However removing this doesn't seem to effect the error.

birksy89 avatar Aug 24 '22 13:08 birksy89

Going back to basics this morning - I managed to get it working 🎉

app.json

{
  "buildpacks": [{ "url": "heroku/nodejs" }],
  "addons": ["heroku-postgresql:standard-0"],
  "environments": {
    "test": {
      "stack": "heroku-20",
      "addons": ["heroku-postgresql:in-dyno"],
      "buildpacks": [
        { "url": "https://github.com/mxschmitt/heroku-playwright-buildpack.git" },
        { "url": "heroku/nodejs" }
      ],
      "env": {
        "PLAYWRIGHT_BUILDPACK_BROWSERS": "chromium,firefox"
      },
      "scripts": {
        "test-setup": "npx playwright install",
        "test": "npx playwright test"
      }
    },
    "review": {
      "addons": ["heroku-postgresql:hobby-dev"]
    }
  }
}

playwright.config.ts

image

birksy89 avatar Aug 25 '22 11:08 birksy89

Not advertising just let you know, I found a solution see this for someone who is still getting Please run the following command to download new browsers: npx playwright install-deps: https://dev.to/rikus3n/deploy-playwright-on-heroku-2c90

rikusen0335 avatar Feb 17 '23 01:02 rikusen0335