Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ValerioNeriGit opened this issue Apr 10, 2024 · 5 comments

Comments

@ValerioNeriGit
Copy link

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
Copy link
Owner

umihico commented Apr 11, 2024

@ValerioNeriGit

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

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

@valentingarnier
Copy link

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
Copy link
Owner

umihico commented May 14, 2024

@valentingarnier

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

@valentingarnier
Copy link

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

@wbt
Copy link

wbt commented Dec 18, 2024

Thanks for your work on this!
I'm also running into this issue, with the published image. Copied from the README, the dockerfile is:

FROM umihico/aws-lambda-selenium-python:latest

COPY main.py ./
CMD [ "main.handler" ]

main.py is unchanged from the repo.

I build it with docker build --platform linux/amd64 -t <my AWS account ID>.dkr.ecr.us-east-1.amazonaws.com/docker-selenium-lambda-test --provenance=false . Note that in this command and those below, <my AWS account ID> is replaced by several digits corresponding to the AWS account ID.

After having previously created the docker-selenium-lambda-test ECR repository in us-east-1 via the Web console and locally run aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin <my AWS account ID>.dkr.ecr.us-east-1.amazonaws.com, I run docker push <my AWS account ID>.dkr.ecr.us-east-1.amazonaws.com/docker-selenium-lambda-test. The image pushes up correctly and I can see it in the previously empty ECR repo.

Via the Web console, I then create a new Lambda function from that image, docker-selenium-lambda-test-lambda, leaving the default x86_64 architecture (having heard that Chrome has difficulties on arm64), and after creation, change the default timeout from 3 seconds to 3 minutes. I test it with the default test event and get pretty much the same as the above, with expected minor variations (like a different request ID and different memory addresses in the first Stacktrace).

UPDATE: Changing the configuration to 2048MB memory fixed it. Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants