I’m building a Python Telegram bot (using paid version of Chat GPT), deployed as a background service on Render. The bot runs every 5 minutes and performs:
Symbol screening via Bybit API (aiohttp)
Saves filtered symbols to shortlisted.json
Opens TradingView in headless Chromium via Playwright
Analyzes candle colors via OpenCV and sends Telegram alerts
Stack: Python 3.10 + Playwright + python-telegram-bot + aiohttp Hosting: Render (Frankfurt region, background service) Browser path: /tmp/playwright (set in render.yaml and code)
render.yaml:
services:
- type: background
name: bybit-bot
env: python
region: frankfurt
branch: main
envVars:
- key: PLAYWRIGHT_BROWSERS_PATH
value: /tmp/playwright
buildCommand: |
pip install -r requirements.txt
playwright install chromium
startCommand: python bot.py
requirements.txt (fragment):
aiohttp
python-telegram-bot==13.15
opencv-python
playwright
Key code from shortlist_filter.py:
import os
os.environ["PLAYWRIGHT_BROWSERS_PATH"] = "/tmp/playwright"
from check_candles import take_screenshot_and_analyze
...
await take_screenshot_and_analyze(symbol) # launches playwright.chromium
Persistent error on every run:
BrowserType.launch: Executable doesn't exist at /tmp/playwright/chromium_headless_shell-1181/chrome-linux/headless_shell Please run: playwright install
What I’ve already tried:
- Added PLAYWRIGHT_BROWSERS_PATH to both render.yaml and code
- Set playwright install chromium in buildCommand
- Tried calling playwright install chromium manually
- Verified the bot deploys successfully, but fails at launch
- Playwright is installed, but browser binary seems missing
The failure occurs at browser = playwright.chromium.launch(...)
I did run playwright install, and it's already included in the render.yaml as part of the buildCommand. Here’s the part of the render.yaml: buildCommand: | pip install -r requirements.txt playwright install chromium startCommand: python bot.py / I also explicitly set the environment variable. BUT the Render log still shows error: BrowserType.launch: Executable doesn't exist at /tmp/playwright/chromium_headless_shell-1181/chrome-linux/headless_shell
PS. I build this bot using Chat GPT and when I was building the first part of it, I discovered that it was using old data for the Exchange API documentation, for example - so I had to manually find path to latest version of API data and upload it to Chat GPT, so that it generates the correct code. I don't know if the same problem could be with Playwright documentation
What I need:
- How to properly install and run Chromium in headless mode on Render? (PPS - when I was testing this code using VS Code on my Mac, I have noticed, that it doesn't work with headless browser, I don't know if non-headless one is supported on Render).
- Why doesn’t playwright install chromium persist the binary to /tmp/playwright?
Anyone faced similar issues with Playwright on render?