You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm facing an issue while deploying a Python app on Heroku that utilizes Playwright to launch Chromium. Despite following best practices and ensuring the Chromium executable is present in the expected directory, I consistently receive an error stating that the "executable doesn't exist".
withsync_playwright() asp:
# Troubleshooting for local and Heroku builddefault_path="/app/.heroku/python/lib/python3.11/site-packages/playwright/driver/package/.local-browsers/chromium-1071/chrome-linux/chrome"chromium_path=os.getenv("PLAYWRIGHT_CHROMIUM_PATH", default_path)
browser=p.chromium.launch(
headless=True, # Set False for debugging and local devargs=['--no-sandbox'],
executable_path=chromium_path
)
# ... rest of code
Error Message playwright._impl._api_types.Error: Failed to launch chromium because executable doesn't exist at /app/.heroku/python/lib/python3.11/site-packages/playwright/driver/package/.local-browsers/chromium-1071/chrome-linux/chrome
However, running heroku run bash and verify presence of the executable using ls, I can clearly see the Chromium executable present at the mentioned path.
Steps Taken:
Verified the presence of the Chromium executable on the Heroku Dyno.
Ensured the Playwright buildpack is correctly set up and is first in the order.
Tried using different environment variables including PLAYWRIGHT_BROWSERS_PATH and PLAYWRIGHT_CHROMIUM_PATH.
Checked for any potential conflicts with Selenium (previously used in the project) and its associated environment variables.
Expected
Playwright should successfully launch Chromium without any errors.
Actual
Playwright consistently fails to launch Chromium with an error stating the executable doesn't exist, even though it's present in the directory.
The text was updated successfully, but these errors were encountered:
This solution on Stack Overflow helped me - Stack Overflow
Heroku's filesystem is both ephemeral and dyno-local. Any changes made to it are lost when the dyno restarts. More importantly at the moment, when you run something like heroku run bash you don't connect to a running dyno. Instead, you get a separate one-off dyno.
Installing Chromium (or making any other filesystem changes) in such an environment will never affect what is available in your other dynos.
It looks like Playwright really wants to manage its own browser binaries. Your best bet might be to run playwright install near the beginning of your script, e.g. something like this:
I recently made a buildpack to address this issue. I did made it to use Chromium but it should work with Firefox and Webkit as well. Feel free to give it a look
Description
I'm facing an issue while deploying a Python app on Heroku that utilizes Playwright to launch Chromium. Despite following best practices and ensuring the Chromium executable is present in the expected directory, I consistently receive an error stating that the "executable doesn't exist".
Env Details
Platform: Heroku
Buildpacks (in order):
mxschmitt/heroku-playwright-buildpack
heroku/python
Python V: 3.11
Playwright V: 1.36.0
Heroku Stack: heroku-22
Relevant Code:
Error Message
playwright._impl._api_types.Error: Failed to launch chromium because executable doesn't exist at /app/.heroku/python/lib/python3.11/site-packages/playwright/driver/package/.local-browsers/chromium-1071/chrome-linux/chrome
However, running
heroku run bash
and verify presence of the executable usingls
, I can clearly see the Chromium executable present at the mentioned path.Steps Taken:
Verified the presence of the Chromium executable on the Heroku Dyno.
Ensured the Playwright buildpack is correctly set up and is first in the order.
Tried using different environment variables including PLAYWRIGHT_BROWSERS_PATH and PLAYWRIGHT_CHROMIUM_PATH.
Checked for any potential conflicts with Selenium (previously used in the project) and its associated environment variables.
Expected
Playwright should successfully launch Chromium without any errors.
Actual
Playwright consistently fails to launch Chromium with an error stating the executable doesn't exist, even though it's present in the directory.
The text was updated successfully, but these errors were encountered: