3

I got stuck in an issue. I was needed to do some scraping stuff on AWS lambda so I have followed the below-mentioned blog and its codebase as a starting point which was very helpful and was working perfectly fine for me on AWS lambda with Runtime Environment: Python 3.6

https://manivannan-ai.medium.com/python-selenium-on-aws-lambda-b4b9de44b8e1 https://github.com/ManivannanMurugavel/selenium-python-aws-lambda

Then I faced an issue that with the above-used sample code was not able to download the file on click. After looking over the internet I came to know that version of chrome driver and chromium binaries which is 62 doesn't support this feature. So I started looking for later versions of binaries. I have used several binaries (chrome driver and chromium) obviously the compatible pairs but for all those, I couldn't get success and having the same below error.

enter image description here

I have tried the binaries given in this repo but not working for me.

https://github.com/vittorio-nardone/selenium-chromium-lambda

These are other sources from where I have tried different versions but didn't work for me.

https://chromium.cypress.io/ https://github.com/adieuadieu/serverless-chrome/releases

  "errorMessage": "Message: unknown error: Chrome failed to start: exited abnormally.\n  (chrome not reachable)\n  (The process started from chrome location /opt/chromium is no longer running, so ChromeDriver is assuming that Chrome has crashed.)\n",

Folks on the internet/forums say about this error is due to version incompatibility between chrome driver and chromium binaries. But I have carefully taken this into consideration but still having no success. Please guide me on how can I make it work. Thanks in advance.

Awais Khan
  • 175
  • 1
  • 15

2 Answers2

0

You can try adding the below line:

chrome_options.add_argument('--disable-dev-shm-usage')

This ignores the /dev/shm directory which is used by Chrome to store files. Since this directory has a small size on aws lambda as it is a docker container, we can disable it.

Tomerikoo
  • 18,379
  • 16
  • 47
  • 61
Fuze Test
  • 31
  • 6
0

Vittorio-Nardone sample https://github.com/vittorio-nardone/selenium-chromium-lambda updated the Chrome driver to 86. It works for me.

However, if I add an Environment variable FONTCONFIG_PATH=/opt/bin , I will have the same chrome error. It could be something wrong with fonts.conf.

Rico
  • 11
  • 1
  • 3