Encountered several problems deploying with zappa
flask
application with selenium
, using chromedriver
and headless_chromium
.
Deployment goes well right utill the end, when it gives 502 error. zappa tail
reveals the following exception:
: WebDriverException
Traceback (most recent call last):
File "/var/task/handler.py", line 580, in lambda_handler
return LambdaHandler.lambda_handler(event, context)
File "/var/task/handler.py", line 245, in lambda_handler
handler = cls()
File "/var/task/handler.py", line 139, in __init__
self.app_module = importlib.import_module(self.settings.APP_MODULE)
File "/var/lang/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/tmp/lambda-selenium/src/main.py", line 29, in <module>
driver = webdriver.Chrome('/tmp/lambda-selenium/bin/headless-chromium', chrome_options=chrome_options)
File "/tmp/lambda-selenium/selenium/webdriver/chrome/webdriver.py", line 73, in __init__
self.service.start()
File "/tmp/lambda-selenium/selenium/webdriver/common/service.py", line 98, in start
self.assert_process_still_running()
File "/tmp/lambda-selenium/selenium/webdriver/common/service.py", line 111, in assert_process_still_running
% (self.path, return_code)
selenium.common.exceptions.WebDriverException: Message: Service /tmp/lambda-selenium/bin/headless-chromium unexpectedly exited. Status code was: 1
As far as i remember6 when this error is encountered locally it is easily fixed by installing some missing packages. But is it the case with Lambda? And if it is, then how do I install them on Lambda?
Honestly, I've ran out of all ideas what might be the case. I deployed using this two guides: