Currently I am trying to host and schedule a python script via Heroku. The script should use the playwright browser.
The problem is that, even with using the heroku playwright buildpackage, it is not working. The deployment runs fine and in the deployment logs the installation of the buildpackage is highlighted.
-----> Building on the Heroku-20 stack
-----> Using buildpacks:
1. https://github.com/mxschmitt/heroku-playwright-buildpack
2. heroku/python
-----> Playwright app detected
-----> Installing System Dependencies
Cloning into '.'...
Installing Playwright dependencies (env: PLAYWRIGHT_BUILDPACK_BROWSERS) for chromium,firefox,webkit.
-----> Detected Aptfile or Stack changes, flushing cache
-----> Updating apt caches
When I execute the script the following occurs:
Application Logs
2021-11-21T17:01:08.657708+00:00 app[advanced-scheduler.5395]: ╔═════════════════════════════════════════════════════════════════════════╗
2021-11-21T17:01:08.657708+00:00 app[advanced-scheduler.5395]: ║ Looks like Playwright Test or Playwright was just installed or updated. ║
2021-11-21T17:01:08.657708+00:00 app[advanced-scheduler.5395]: ║ Please run the following command to download new browsers: ║
2021-11-21T17:01:08.657708+00:00 app[advanced-scheduler.5395]: ║ ║
2021-11-21T17:01:08.657708+00:00 app[advanced-scheduler.5395]: ║ playwright install ║
2021-11-21T17:01:08.657708+00:00 app[advanced-scheduler.5395]: ║ ║
2021-11-21T17:01:08.657709+00:00 app[advanced-scheduler.5395]: ║ <3 Playwright Team ║
2021-11-21T17:01:08.657710+00:00 app[advanced-scheduler.5395]: ╚═════════════════════════════════════════════════════════════════════════╝
Locally everything works fine.
Code goes like this: (shortened for simplicity)
from playwright.sync_api import sync_playwright
with sync_playwright() as p:
browser = p.chromium.launch()
page = browser.new_page()
page.goto("https://example.com")
browser.close()
Python version to run is 3.9.9