lambda-packs icon indicating copy to clipboard operation
lambda-packs copied to clipboard

Connection Refused Only for HTTPS

Open jbizznizz opened this issue 3 years ago • 0 comments

I'm running this code on Lambda and I modified the handler to accept different test scripts. It works great for HTTP sites, but the connection is refused anytime I load HTTPS. Any thoughts? Below is the error and modified service file.

ERROR

START RequestId: 80ac0c45-5473-442d-882c-3825e89f29d6 Version: $LATEST <urlopen error [Errno 111] Connection refused>: URLError Traceback (most recent call last): File "/var/task/service.py", line 34, in handler exec(script, globals()) File "", line 36, in File "", line 2, in test_qGlobalCreateClient File "/var/task/selenium/webdriver/remote/webdriver.py", line 693, in implicitly_wait 'ms': float(time_to_wait) * 1000}) File "/var/task/selenium/webdriver/remote/webdriver.py", line 234, in execute response = self.command_executor.execute(driver_command, params) File "/var/task/selenium/webdriver/remote/remote_connection.py", line 407, in execute return self._request(command_info[0], url, body=data) File "/var/task/selenium/webdriver/remote/remote_connection.py", line 477, in _request resp = opener.open(request, timeout=self._timeout) File "/usr/lib64/python2.7/urllib2.py", line 429, in open response = self._open(req, data) File "/usr/lib64/python2.7/urllib2.py", line 447, in _open '_open', req) File "/usr/lib64/python2.7/urllib2.py", line 407, in _call_chain result = func(*args) File "/usr/lib64/python2.7/urllib2.py", line 1237, in http_open return self.do_open(httplib.HTTPConnection, req) File "/usr/lib64/python2.7/urllib2.py", line 1207, in do_open raise URLError(err) URLError: <urlopen error [Errno 111] Connection refused>

SERVICE.PY (excluding imports)

user_agent = ("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.111 Safari/537.36") dcap = dict(DesiredCapabilities.PHANTOMJS) dcap["phantomjs.page.settings.userAgent"] = user_agent dcap["phantomjs.page.settings.javascriptEnabled"] = True driver = webdriver.PhantomJS(service_log_path=os.path.devnull, executable_path="/var/task/phantomjs", service_args=['--ignore-ssl-errors=true'], desired_capabilities=dcap)

def handler(event, context): event_string = json.dumps(event) dictionary = json.loads(event_string) input = json.dumps(dictionary["Base64Script"]) script = base64.b64decode(input) exec(script, globals()) print(os.popen('df -k /tmp ; ls -al /tmp').read()) os.popen('rm -rf /tmp/')

jbizznizz avatar Mar 11 '21 21:03 jbizznizz