playwright-community / heroku-playwright-buildpack

Buildpack for running Playwright with Chromium and Firefox on Heroku.
https://heroku.playwright.tech
48 stars 47 forks source link

Doesn't working properly on Heroku #17

Open matheuschimelli opened 2 years ago

matheuschimelli commented 2 years ago

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:

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)
bauerjon commented 2 years ago

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?

matheuschimelli commented 2 years ago

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.

bauerjon commented 2 years ago

@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

matheuschimelli commented 2 years ago

@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.

ZeroByter commented 2 years ago

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.

matheuschimelli commented 2 years ago

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.

amy-mac commented 2 years ago

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.

hbtalha commented 2 years ago

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

zibdie commented 2 years ago

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]: ╚════════════════════════════════════════════════════════════╝
birksy89 commented 2 years ago

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 playwright-chromium@1.15.0

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 commented 2 years ago

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

rikusen0335 commented 1 year ago

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