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

Requesting Python 3.10 Upgrade for QuARC Lambda Environment Due to TLS 1.3 Support #280

Open
rajeshpandey2053 opened this issue Apr 11, 2024 · 2 comments
Assignees

Comments

@rajeshpandey2053
Copy link
Contributor

Describe the bug
QuARC currently relies on Lambda for deployment, utilizing Python 3.8 as the runtime environment. However, pyQuARC dependencies are also tied to Python 3.8.

We've encountered an issue stemming from the older version of OpenSSL installed in the Python 3.8 runtime environment, which results in errors when making requests to certain web endpoints.

To mitigate this, we propose upgrading the Python runtime environment to version 3.10.

To Reproduce
Steps to reproduce the behavior:

  1. Go to AWS lambda and set the runtime as Python 3.8
  2. Run the following code in the handler.py
import requests
url = "https://www.atmosp.physics.utoronto.ca/MOPITT/home.html"
response=requests.get(url, headers=headers, timeout=10).status_code
print(response)
  1. See the error as follows
    { "errorMessage": "HTTPSConnectionPool(host='www.atmosp.physics.utoronto.ca', port=443): Max retries exceeded with url: /MOPITT/home.html (Caused by SSLError(SSLError(1, '[SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:1131)')))", "errorType": "SSLError", "stackTrace": [ " File \"/var/task/lambda_function.py\", line 132, in lambda_handler\n \"body\": json.dumps(requests.get(url).text),\n", " File \"/var/task/requests/api.py\", line 76, in get\n return request('get', url, params=params, **kwargs)\n", " File \"/var/task/requests/api.py\", line 61, in request\n return session.request(method=method, url=url, **kwargs)\n", " File \"/var/task/requests/sessions.py\", line 530, in request\n resp = self.send(prep, **send_kwargs)\n", " File \"/var/task/requests/sessions.py\", line 643, in send\n r = adapter.send(request, **kwargs)\n", " File \"/var/task/requests/adapters.py\", line 514, in send\n raise SSLError(e, request=request)\n" ] }

Expected behavior
Upgrading the Python runtime environment to 3.10 should align the dependencies across QuARC and Lambda, resolving the OpenSSL version discrepancy and ensuring smooth operation when making web requests.

Additional context

  • QuARC relies on Lambda deployment for its infrastructure.
  • pyQuARC dependencies are designed for Python 3.8.
  • The discrepancy between Python versions is causing issues with OpenSSL versions, leading to errors in web requests.
  • Python 3.10, with its use of the latest OpenSSL version (2023), offers TLS 1.3 support, addressing our current limitations.
  • To verify the OpenSSL version used by Python, execute the following code:
 import ssl
print(ssl.OPENSSL_VERSION)
@rajeshpandey2053
Copy link
Contributor Author

Upgraded python to version 3.9 in QuARC deployment. Link to PR

@smk0033
Copy link
Contributor

smk0033 commented Oct 3, 2024

Since this is merged, is it okay for this issue to be closed? @xhagrg @rajeshpandey2053

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

2 participants