質問編集履歴
1
質問の修正
title
CHANGED
@@ -1,1 +1,1 @@
|
|
1
|
-
lambdaで
|
1
|
+
lambdaでchromedriverが読み込めない(127)
|
body
CHANGED
@@ -10,16 +10,15 @@
|
|
10
10
|
↓
|
11
11
|
chromedriver_linux64.zipをダウンロード
|
12
12
|
↓
|
13
|
-
上記二つのドライバーに chmod 777 で権限付与
|
13
|
+
解凍し出来た上記二つのドライバーファイルに chmod 777 で権限付与
|
14
14
|
↓
|
15
|
-
名前「
|
15
|
+
名前「bin」のフォルダを作成し上記二つのドライバーを入れてbin.zip生成
|
16
16
|
↓
|
17
|
-
|
17
|
+
bin.zipをレイヤーにアップロード
|
18
18
|
↓
|
19
|
-
|
19
|
+
cloud9でsudo pip install selenium -t ./でseleniumをダウンロードしローカルに落とす
|
20
|
-
でseleniumをダウンロード
|
21
20
|
↓
|
22
|
-
|
21
|
+
落としてきたフォルダをzipに生成
|
23
22
|
↓
|
24
23
|
レイヤーにアップロード
|
25
24
|
↓
|
@@ -31,10 +30,35 @@
|
|
31
30
|
### 発生している問題・エラーメッセージ
|
32
31
|
|
33
32
|
```
|
33
|
+
Response
|
34
34
|
{
|
35
|
-
"errorMessage": "
|
35
|
+
"errorMessage": "Message: Service /opt/bin/chromedriver unexpectedly exited. Status code was: 127\n",
|
36
|
-
"errorType": "
|
36
|
+
"errorType": "WebDriverException",
|
37
|
+
"stackTrace": [
|
38
|
+
" File \"/var/task/lambda_function.py\", line 12, in lambda_handler\n browser = webdriver.Chrome('/opt/bin/chromedriver', chrome_options=options)\n",
|
39
|
+
" File \"/opt/python/selenium/webdriver/chrome/webdriver.py\", line 73, in __init__\n self.service.start()\n",
|
40
|
+
" File \"/opt/python/selenium/webdriver/common/service.py\", line 98, in start\n self.assert_process_still_running()\n",
|
41
|
+
" File \"/opt/python/selenium/webdriver/common/service.py\", line 109, in assert_process_still_running\n raise WebDriverException(\n"
|
42
|
+
]
|
37
43
|
}
|
44
|
+
|
45
|
+
Function Logs
|
46
|
+
START RequestId: 8bf2d40a-ef24-4cb0-a8d9-0eb18885bd6d Version: $LATEST
|
47
|
+
[ERROR] WebDriverException: Message: Service /opt/bin/chromedriver unexpectedly exited. Status code was: 127
|
48
|
+
|
49
|
+
Traceback (most recent call last):
|
50
|
+
File "/var/task/lambda_function.py", line 12, in lambda_handler
|
51
|
+
browser = webdriver.Chrome('/opt/bin/chromedriver', chrome_options=options)
|
52
|
+
File "/opt/python/selenium/webdriver/chrome/webdriver.py", line 73, in __init__
|
53
|
+
self.service.start()
|
54
|
+
File "/opt/python/selenium/webdriver/common/service.py", line 98, in start
|
55
|
+
self.assert_process_still_running()
|
56
|
+
File "/opt/python/selenium/webdriver/common/service.py", line 109, in assert_process_still_running
|
57
|
+
raise WebDriverException(END RequestId: 8bf2d40a-ef24-4cb0-a8d9-0eb18885bd6d
|
58
|
+
REPORT RequestId: 8bf2d40a-ef24-4cb0-a8d9-0eb18885bd6d Duration: 1149.92 ms Billed Duration: 1150 ms Memory Size: 128 MB Max Memory Used: 59 MB Init Duration: 279.31 ms
|
59
|
+
|
60
|
+
Request ID
|
61
|
+
8bf2d40a-ef24-4cb0-a8d9-0eb18885bd6d
|
38
62
|
```
|
39
63
|
|
40
64
|
### 該当のソースコード
|
@@ -45,13 +69,13 @@
|
|
45
69
|
|
46
70
|
def lambda_handler(event, context):
|
47
71
|
options = Options()
|
48
|
-
options.binary_location = '/opt/
|
72
|
+
options.binary_location = '/opt/bin/headless-chromium'
|
49
73
|
options.add_argument('--headless')
|
50
74
|
options.add_argument('--no-sandbox')
|
51
75
|
options.add_argument('--single-process')
|
52
76
|
options.add_argument('--disable-dev-shm-usage')
|
53
77
|
|
54
|
-
browser = webdriver.Chrome('/opt/
|
78
|
+
browser = webdriver.Chrome('/opt/bin/chromedriver', chrome_options=options)
|
55
79
|
browser.get('https://www.google.com')
|
56
80
|
title = browser.title
|
57
81
|
browser.close()
|
@@ -62,5 +86,4 @@
|
|
62
86
|
|
63
87
|
### 試したこと
|
64
88
|
|
65
|
-
seleniumのモジュールが見つけられていないようなので生成したzipがおかしい?ような気がするのですが。。
|
66
89
|
分かる方おられたご回答よろしくお願いします。
|