Missing import from urllib3.util.ssl_ library causing AWS issues
See original GitHub issueDescribe the bug
After using boto3-1.20 in AWS Lambda, we are experiencing this issue:
{ "errorMessage": "Unable to import module 'app': cannot import name 'OP_NO_TICKET' from 'urllib3.util.ssl_' (/opt/python/urllib3/util/ssl_.py)", "errorType": "Runtime.ImportModuleError", "stackTrace": [] }
Our Lambda function is unable to start up because of this issue. We are using Python 3.8.
Steps to reproduce
import requests
from requests.adapters import HTTPAdapter
from urllib3.util.retry import Retry
from aws_requests_auth.boto_utils import BotoAWSRequestsAuth
def create_api_session(aws_host, aws_region, aws_service):
"""
Generic api session
"""
api_session = requests.Session()
retries = Retry(
total=5,
backoff_factor=1,
status_forcelist=[500, 502, 503, 504]
)
api_session.mount('https://', HTTPAdapter(max_retries=retries))
auth = BotoAWSRequestsAuth(
aws_host=aws_host,
aws_region=aws_region,
aws_service=aws_service
)
api_session.auth = auth
return api_session
Expected behavior
We expect our lambda to run properly by being able to import the OP_NO_TICKET from the ssl package.
Debug logs There are no debug logs as our lambda application cannot start up.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:9
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Importerror cannot import name ssl from urllib3 util ssl_ : Fix
In some scenarios, the incompatible version of awscli cause this error. The fix is really simple. All you need to reinstall it. Here...
Read more >from urllib3.util.ssl_ import ( ImportError: cannot import name ssl
Could be some issue with installation. I did re-installed on MAC and it worked sudo pip install awscli --ignore-installed six.
Read more >Troubleshooting AWS CLI errors - AWS Command Line Interface
When you use a AWS CLI command, you receive an [SSL: CERTIFICATE_ VERIFY_FAILED] certificate verify failed error message. This is caused by the...
Read more >Advanced Usage - urllib3 1.26.13 documentation
This happens on Python 2 platforms that have an outdated ssl module. These older ssl modules can cause some insecure requests to succeed...
Read more >"cannot import name 'ssl'" when creating pipenv environment ...
ImportError: cannot import name 'ssl' from 'urllib3.util.ssl_' ... virtualenvs\graph-ngLyIbg6\lib\site-packages\botocore\awsrequest.py:26: in <module> ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi everyone, this is a duplicate of boto/botocore#2562. We have a fix we’re working on getting released but immediate mitigation instructions are available in the linked ticket.
⚠️COMMENT VISIBILITY WARNING⚠️
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.