Closed Turkmen1Mehmet closed 1 year ago
@Turkmen1Mehmet I saw some modifications, but they does not seem to be related. Because I could simply reproduce the error by following these steps
example.com
to www.zara.com/tr
docker build -t my-selenium-lambda . && docker run -p 8080:8080 --platform=linux/amd64 --memory=8g --cpus=2 my-selenium-lambda
curl -XPOST "http://localhost:8080/2015-03-31/functions/function/invocations" -d '{}'
I could solve this error to increase memory limit, which is from 8g to 16g. But the response does not look good for your purpose. It was "Access Denied\nYou don't have permission to access \"http://www.zara.com/tr\" on this server.\nReference
Reopen this if you still have the error.
BTW you shouldn't share your AWS account ID
@umihico Dockerfile:
serverless.yml
main.py
the ones i run in terminal respectively TERMİNAL:
docker build -t my-selenium-lambda .
docker run -p 8080:8080 --platform=linux/amd64 --memory=8g --cpus=2 my-selenium-lambda
curl -XPOST "http://localhost:8080/2015-03-31/functions/function/invocations" -d '{}'
mehmetturkmen@Mehmet-MacBook-Pro docker-selenium-lambda-memo % curl -XPOST "http://localhost:8080/2015-03-31/functions/function/invocations" -d '{}' {"errorMessage": "Message: unknown error: Chrome failed to start: crashed.\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 0x0040006d74e3\n#1 0x004000406c76 \n#2 0x00400042fd78 \n#3 0x00400042c029 \n#4 0x00400046accc \n#5 0x00400046a47f \n#6 0x004000461de3 \n#7 0x0040004372dd \n#8 0x00400043834e \n#9 0x0040006973e4 \n#10 0x00400069b3d7 \n#11 0x0040006a5b20 \n#12 0x00400069c023 \n#13 0x00400066a1aa \n#14 0x0040006c06b8 \n#15 0x0040006c0847 \n#16 0x0040006d0243 \n#17 0x004002aaf44b start_thread\n", "errorType": "WebDriverException", "requestId": "e30cb129-4e33-4000-916e-0aa0c9544f31", "stackTrace": [" File \"/var/task/main.py\", line 28, in handler\n browser = webdriver.Chrome(options=op)\n", " File \"/var/lang/lib/python3.10/site-packages/selenium/webdriver/chrome/webdriver.py\", line 49, in init\n super().init(\n", " File \"/var/lang/lib/python3.10/site-packages/selenium/webdriver/chromium/webdriver.py\", line 54, in init\n super().init(\n", " File \"/var/lang/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py\", line 206, in init\n self.start_session(capabilities)\n", " File \"/var/lang/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py\", line 291, in start_session\n response = self.execute(Command.NEW_SESSION, caps)[\"value\"]\n", " File \"/var/lang/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py\", line 346, in execute\n self.error_handler.check_response(response)\n", " File \"/var/lang/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py\", line 245, in check_response\n raise exception_class(message, screen, stacktrace)\n"]}%
mehmetturkmen@Mehmet-MacBook-Pro docker-selenium-lambda-memo % docker run -p 8080:8080 --platform=linux/amd64 --memory=8g --cpus=2 my-selenium-lambda
04 Jul 2023 13:14:11,935 [INFO] (rapid) exec '/var/runtime/bootstrap' (cwd=/var/task, handler=) 04 Jul 2023 13:14:17,540 [INFO] (rapid) extensionsDisabledByLayer(/opt/disable-extensions-jwigqn8j) -> stat /opt/disable-extensions-jwigqn8j: no such file or directory 04 Jul 2023 13:14:17,541 [INFO] (rapid) Configuring and starting Operator Domain 04 Jul 2023 13:14:17,541 [INFO] (rapid) Starting runtime domain 04 Jul 2023 13:14:17,542 [WARNING] (rapid) Cannot list external agents error=open /opt/extensions: no such file or directory 04 Jul 2023 13:14:17,546 [INFO] (rapid) Starting runtime without AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN , Expected?: false START RequestId: 6ec38ac0-d9ca-45ac-a5a1-bdd927889297 Version: $LATEST [ERROR] WebDriverException: Message: unknown error: Chrome failed to start: crashed. (chrome not reachable) (The process started from chrome location /opt/chrome/chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.) Stacktrace:
0 0x0040006d74e3
1 0x004000406c76
2 0x00400042fd78
3 0x00400042c029
4 0x00400046accc
5 0x00400046a47f
6 0x004000461de3
7 0x0040004372dd
8 0x00400043834e
9 0x0040006973e4
10 0x00400069b3d7
11 0x0040006a5b20
12 0x00400069c023
13 0x00400066a1aa
14 0x0040006c06b8
15 0x0040006c0847
16 0x0040006d0243
17 0x004002aaf44b start_thread
File "/var/lang/lib/python3.10/site-packages/selenium/webdriver/chrome/webdriv File "/var/lang/lib/python3.10/site-packages/selenium/webdriver/chromium/webdr File "/var/lang/lib/python3.10/site-packages/selenium/webdriver/remote/webdriv File "/var/lang/lib/python3.10/site-packages/selenium/webdriver/remote/webdriv File "/var/lang/lib/python3.10/site-packages/selenium/webdriver/remote/webdriv File "/var/lang/lib/python3.10/site-packages/selenium/webdriver/remote/errorha raise exception_class(message, screen, stacktrace) END RequestId: e30cb129-4e33-4000-916e-0aa0c9544f31 REPORT RequestId: e30cb129-4e33-4000-916e-0aa0c9544f31 Init Duration: 3.25 ms Duration: 15149.74 ms Billed Duration: 15150 ms Memory Size: 3008 MB Max Memory Used: 3008 MB
The error I get is this way, when I look at the files in docker, chromedriver and opt/chrome/chrome appear there, but I keep getting the same error.