saraf0509
saraf05092mo ago

Running scheduled reports - chromium not working

Hey team, I'm trying to run scheduled reports of the app - but for some reason, chromium is not working. On the default puppeteer code - the browser is setup, but it gets stuck on the .newPage() command, and eventually errors out with the following
ProtocolError: Network.enable timed out. Increase the 'protocolTimeout' setting in launch/connect calls for a higher timeout if needed.
ProtocolError: Network.enable timed out. Increase the 'protocolTimeout' setting in launch/connect calls for a higher timeout if needed.
I then tried rewriting the script in playwright, and selenium, but neither of those work.On selenium, exits with
WebDriverException: Message: Service /usr/bin/chromium unexpectedly exited. Status code was: 1
WebDriverException: Message: Service /usr/bin/chromium unexpectedly exited. Status code was: 1
This is already running on the default reports worker - which is why the code is able to discover the chromium executable - but for some reason, no page is able to open What could I be doing wrong?
11 Replies
rubenf
rubenf2mo ago
Not sure, can you check that your worker can access your base_url
saraf0509
saraf05092mo ago
Yeah - that seems to be the issue
import requests

def main():
# Initialize a client
result = requests.get("http://localhost/public/zamp/a71232fc1e7fe314fab838d30ed6ec00")
return result.json()
import requests

def main():
# Initialize a client
result = requests.get("http://localhost/public/zamp/a71232fc1e7fe314fab838d30ed6ec00")
return result.json()
This fails with
ConnectionError: HTTPConnectionPool(host='localhost', port=80): Max retries exceeded with url: /public/zamp/a71232fc1e7fe314fab838d30ed6ec00 (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0xffffa1c4cd10>: Failed to establish a new connection: [Errno 111] Connection refused'))
ConnectionError: HTTPConnectionPool(host='localhost', port=80): Max retries exceeded with url: /public/zamp/a71232fc1e7fe314fab838d30ed6ec00 (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0xffffa1c4cd10>: Failed to establish a new connection: [Errno 111] Connection refused'))
ping localhost
ping localhost
and
telnet localhost 80
telnet localhost 80
from my laptop CLI work though Why guidance on what the issue could be? Okay this worked
requests.get("http://host.docker.internal/public/zamp/a71232fc1e7fe314fab838d30ed6ec00")
requests.get("http://host.docker.internal/public/zamp/a71232fc1e7fe314fab838d30ed6ec00")
But the page creation still does not work Hey @rubenf tried on a different machine, but it's still not working. Is it not recommended to have the base URL as just localhost? Why could I be facing this?
rubenf
rubenf2mo ago
the report script will use the base url to create the report. If that base url is not reachable from the workers then it won't work
saraf0509
saraf05092mo ago
Yes, but the base URL is accessible within the worker now Page creation is not working
rubenf
rubenf2mo ago
to debug it, write a script that access the app url with the right permission passed as bearer token and see if it can indeed fetch the page using the base url
saraf0509
saraf05092mo ago
Yes Did so - that works Using basic requests package in python - I am able to get the page HTML On puppeteer - creating a new page fails, before it goes page.goTo
rubenf
rubenf2mo ago
it's just a normal script which you have access to so you need to find the diff between your script that works and the report script we can do more of that work but only for enterprise customers
saraf0509
saraf05092mo ago
Was not an issue with the script - just FYI so you could use it to improve it for others Fails when I specify executablePath='/usr/bin/chromium', In the puppeteer launcher If I don't specify it, puppetter downloads chromium iself And it works
rubenf
rubenf2mo ago
It's meant to be ran by the reports worker group Which install chromium at that path as an init script
saraf0509
saraf05092mo ago
Yes It was running on reports worker group With chromium installed Still didn't work Maybe some version issue Tried on 3 different self hosted instances on dev, staging, and production Didn't work
rubenf
rubenf2mo ago
@saraf0509 I finally investigated and could reproduce it wasn't working with the standard docker-compose, it's fixed on latest, thanks for the investigation We're still using /usr/bin/chromium, but the args are now:
browser = await puppeteer.launch({ headless: true, executablePath: '/usr/bin/chromium', args: ['--no-sandbox',
'--no-zygote',
'--disable-setuid-sandbox',
'--disable-dev-shm-usage',
'--disable-gpu'] });
browser = await puppeteer.launch({ headless: true, executablePath: '/usr/bin/chromium', args: ['--no-sandbox',
'--no-zygote',
'--disable-setuid-sandbox',
'--disable-dev-shm-usage',
'--disable-gpu'] });
we are also now using BASE_URL instead of WM_BASE_URL which will always work since it's the worker using its embedded api