0

I have been trying to take a screenshot of given URL using pyppeteer & FAST in Python. But after many attempts and fixing various errors, I managed to get it installed as an App Engine.

I am using python 3.10 and entry point for my app engine is

gunicorn main:app --timeout 540

But after looking at the logs, every time, the code seems to break at the time of launch of browser. I did try providing executable path, no-sandbox arguments, but the application keeps on failing with Browser terminated with "BrowserError: Browser closed unexpectedly:" error.

For taking screenshot, few other options were also evaluated like html2image, but that seems to require Chrome executable and not chrome driver.

Any help here would be appreciated.

user1401472
  • 2,203
  • 3
  • 23
  • 37

1 Answers1

2

You can't 'install browsers' on GAE Standard (see this & this response)

It's the same reason why you can't run Selenium in GAE standard.

You can do this on Cloud Run

NoCommandLine
  • 5,044
  • 2
  • 4
  • 15
  • I did try with cloud run too, it fails with "No such file or directory: '/home/.local/share/pyppeteer/local-chromium/" error. Chrome driver related libraries were included in Dockerfile. – user1401472 Aug 16 '23 at 03:49
  • 1
    Take a look at [this](https://nocommandline.com/blog/how-to-use-headless-firefox-on-cloud-run/) blog article we have for Cloud Run & Selenium. It might help you out – NoCommandLine Aug 16 '23 at 14:57
  • Thanks. Passed executablePath for pyppeteer it worked. – user1401472 Aug 17 '23 at 14:59