umihico / docker-selenium-lambda

The simplest demo of chrome automation by python and selenium in AWS Lambda
MIT License
493 stars 118 forks source link

Message: session not created: Chrome failed to start: exited normally. #235

Open ValerioNeriGit opened 3 months ago

ValerioNeriGit commented 3 months ago

Hi there,

I tried building your Dockerfile with your main.py but got the following error:

{"errorMessage": "Message: session not created: Chrome failed to start: exited normally.\n (chrome not reachable)\n (The process started from chrome location /opt/chrome/chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)\nStacktrace:\n#0 0x00400077a873 <unknown>\n#1 0x0040004708c6 <unknown>\n#2 0x0040004a4d34 <unknown>\n#3 0x0040004a0d3d <unknown>\n#4 0x0040004e9aed <unknown>\n#5 0x0040004dd343 <unknown>\n#6 0x0040004ae593 <unknown>\n#7 0x0040004aef5e <unknown>\n#8 0x00400073e85b <unknown>\n#9 0x0040007427b5 <unknown>\n#10 0x00400072c581 <unknown>\n#11 0x004000743342 <unknown>\n#12 0x00400071188f <unknown>\n#13 0x004000769738 <unknown>\n#14 0x00400076990b <unknown>\n#15 0x0040007799c4 <unknown>\n#16 0x004002c7e7f2 start_thread\n", "errorType": "SessionNotCreatedException", "requestId": "39439a25-ae7e-463b-a4d6-8920e8cf2355", "stackTrace": [" File \"/var/task/main.py\", line 24, in handler\n chrome = webdriver.Chrome(options=options, service=service)\n", " File \"/var/lang/lib/python3.12/site-packages/selenium/webdriver/chrome/webdriver.py\", line 45, in __init__\n super().__init__(\n", " File \"/var/lang/lib/python3.12/site-packages/selenium/webdriver/chromium/webdriver.py\", line 61, in __init__\n super().__init__(command_executor=executor, options=options)\n", " File \"/var/lang/lib/python3.12/site-packages/selenium/webdriver/remote/webdriver.py\", line 208, in __init__\n self.start_session(capabilities)\n", " File \"/var/lang/lib/python3.12/site-packages/selenium/webdriver/remote/webdriver.py\", line 292, in start_session\n response = self.execute(Command.NEW_SESSION, caps)[\"value\"]\n", " File \"/var/lang/lib/python3.12/site-packages/selenium/webdriver/remote/webdriver.py\", line 347, in execute\n self.error_handler.check_response(response)\n", " File \"/var/lang/lib/python3.12/site-packages/selenium/webdriver/remote/errorhandler.py\", line 229, in check_response\n raise exception_class(message, screen, stacktrace)\n"]}%

This also happens with the published image. Do you have any idea how to solve it?

Thanks

umihico commented 2 months ago

@ValerioNeriGit

スクリーンショット 2024-04-11 9 12 06

Did you follow this step exactly these steps, or customized something?

valentingarnier commented 1 month ago

I have the exact same error after publishing the docker image on AWS Lambda. Do anyone has an idea on how to solve this?

umihico commented 1 month ago

@valentingarnier

Did you follow exactly README's steps with initial files, or customized steps or files?

valentingarnier commented 1 month ago

Indeed @umihico, on my side adding the exact chrome options for selenium made it work. Thanks!