Apify Discord Mirror

Updated last year

How can I deploy Playwright Python script on Heroku?

At a glance
The community member is trying to deploy their Python code on Heroku and is encountering a missing dependencies error to run browsers. They have tried installing the dependencies using playwright install-deps and apt-get install commands, but the issue persists on Heroku. The community members suggest that Heroku may not support Playwright installation and running, and that the community member may need to set up a server for deployment. Some community members provide links to Heroku documentation for Node.js, but the community member is unable to find similar documentation for Python. There is no explicitly marked answer in the comments.
Useful resources
I am trying to deploy my code on Heroku.
using : python3

getting this error on Heroku console.
╔══════════════════════════════════════════════════════╗
║ Host system is missing dependencies to run browsers. ║ ║ Please install them with the following command: ║
║ ║
║ sudo playwright install-deps ║
║ ║
║ Alternatively, use apt: ║
║ sudo apt-get install libatk1.0-0\ ║
║ libatk-bridge2.0-0\ ║
.
.
.
m
S
A
12 comments
Hi, its missing dependencies error, will need to install them before deploy
as we need to install dependency.
in my local machine. I use

playwright install

and same thing I am doing on my Heroku app.
I tried writing this in my Procfile

Plain Text
playwright install && python3 main.py


also I tried this in my code.

Plain Text
if os.getenv("RUN_MODE", "DEV") == "PROD":
    print("RUN MODE: PROD")
    subprocess.run(["playwright", "install"])


but I am getting the issue mentioned in the question.
just advanced to level 1! Thanks for your contributions! 🎉
later onward when that error comes up.
I tried using same way to run this command.

sudo playwright install-deps

but this not being executed in the heroku
well, heroku may not support playwright installing and running on it's env.
I guess it works on local with no error.
if you need it deployed on cloud server, you will have to set up a server
How I can setup on Heroku?
I found documentations for Node JS. but for python not able to find out.
I had no experience with playwright on heroku, maybe I can see the Node documentation?
ok, may I see your app's setting on heroku dashboard?
which setting you wanna see?
Add a reply
Sign up and join the conversation on Discord