How can I deploy Playwright Python script on Heroku?

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\ ║ . . .
10 Replies
other-emerald
other-emerald17mo ago
@Soul_Denied ツ Hi, its missing dependencies error, will need to install them before deploy
magic-amber
magic-amberOP17mo ago
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
playwright install && python3 main.py
playwright install && python3 main.py
also I tried this in my code.
if os.getenv("RUN_MODE", "DEV") == "PROD":
print("RUN MODE: PROD")
subprocess.run(["playwright", "install"])
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.
MEE6
MEE617mo ago
@Soul_Denied ツ just advanced to level 1! Thanks for your contributions! 🎉
magic-amber
magic-amberOP17mo ago
@Mathew 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
other-emerald
other-emerald17mo ago
@Soul_Denied ツ 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
magic-amber
magic-amberOP17mo ago
How I can setup on Heroku? I found documentations for Node JS. but for python not able to find out.
other-emerald
other-emerald17mo ago
I had no experience with playwright on heroku, maybe I can see the Node documentation?
other-emerald
other-emerald17mo ago
ok, may I see your app's setting on heroku dashboard?
magic-amber
magic-amberOP17mo ago
which setting you wanna see?

Did you find this page helpful?