question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Missing import from urllib3.util.ssl_ library causing AWS issues

See original GitHub issue

Describe 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:closed
  • Created 2 years ago
  • Reactions:9
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
nateprewittcommented, Nov 8, 2021

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.

0reactions
github-actions[bot]commented, Nov 9, 2021

⚠️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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found