-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
'AWSHTTPSConnection' object has no attribute 'ssl_context' #1258
Comments
Hi, can you share a set of steps that demonstrate the issue? Also, how did you install botocore? I'd like to repro this on our end to confirm the fix. Thanks! |
I am creating route53 dns record via boto3 (which uses botocore): client = boto3.client('route53')
response = client.change_resource_record_sets(
HostedZoneId=hosted_zone,
ChangeBatch={
'Comment': 'Creando empresa ' + self.args.empresa,
'Changes': [
{
'Action': 'UPSERT',
'ResourceRecordSet': {
'Name': source,
'Type': 'CNAME',
'TTL': 300,
'ResourceRecords': [{'Value': target}]
}
}
]
}) Here is the trace my script generates:
I use boto3 and botocore from my distribution (debian unstable). |
I encountered this issue with AWS cli working with S3, and I think it came down to a new version of 'requests' (2.18 vs 2.12) that was installed not working with AWS CLI. Had been using debian testing. Removed it from sources and it worked ok. Issue only popped up within last 24-48 hours. |
Same issue here on Kali Rolling 2017.2. On requests 2.18. |
Same issue with |
These kinds of issues tend to show up when people use Ubuntu, and it seems like it extends to any debian based distribution. The debian package maintainers remove our vendored version of the requests library, which causes issues that we don't really have a lot of control over. |
I disagree with this assessment. Yes, with the (quite old) version of requests bundled into botocore things currently work. This does not mean the current code is correct. Botocore is currently calling the wrong base class constructor. This worked for a while because Please fix |
I didn't mean to imply that this is not an issue or that we can't fix the issue, just that using the packages maintained by debian may have more issues than the versions installed via pip because the debian maintainers remove our vendored version of requests. |
Oh, sorry. I misunderstood what you were saying.
I'd say different issues, rather than more. The requests module also ships bugfixes in new releases. |
I think I have answered these questions. Short recap: you need to unvendor requests, at least version 2.18.1 triggers this problem.
Of course. Anything else I can do to help move this forward? |
A few days ago I bisected requests from git so I have a smaller version range: this incorrect code from botocore works with requests 2.15.1 and fails with requests 2.16.0, which is when requests stopped bundling urllib3. I couldn't figure out why unbundling urllib3 triggers the bug, but I suspect the code was previously ending up with multiple versions of urllib3 loaded at the same time(!), since requests's bundled version had a different package name. |
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=874367 What do I do to work around this? This affects Debian & Ubuntu stable / production. |
This workaround did the trick for me. |
So, This specific error occurred for me on Ubuntu 16.04 using Ansible's aws_s3 module. My workaround was to switch from using the |
Same issue, but strange, because it was working 2 weeks ago, I made no changes and my cron started failing. Original
My workaround (keep original, but add upgrade after):
|
For me it only worked after
And installing via pip. |
I was uploading ssl certificates. |
The same thing happens on openSUSE Tumbleweed. It probably happens always if nice packager guys try to do the right thing and have botocore use the official |
Considering that #1466 unvenders requests and urllib without any apparent adverse effects, and that no maintainer has even bothered to comment... I would say that this issue seems to have been burried deeply. |
Ah, I missed that, thanks. Let's hope that maintainers pick it up soon, then. |
same thing as the above comment from aungwinthant |
We have un-vendored requests/urllib3 and are now using urllib3 directly as of It's important to note that the upgrade notes assumed that you were using a version of Also, as a note to any distro maintainers who had previously un-vendored our vendored version of requests, you'll notice that we do still import some of the old exception classes for backwards compatibility with new exceptions that we throw. This is likely irrelevant as the old vendored exceptions would have never been thrown using these packages (with unvendored requests) and the vendored requests and references to it can probably be removed entirely. |
Not aimed at anyone in particular, but if you stumble on this issue (just like I did today), and you are using letsencrypt Ubuntu PPA |
Another option to avoid this hell is to use python venv. |
On Ubuntu 16.04 What helped us was to downgrade:
sudo apt install python3-requests=2.9.1-3ubuntu0.1 python3-urllib3=1.13.1-2ubuntu0.16.04.2 Care had to be taken that sudo apt install awscli certbot python3-certbot-nginx |
I get this same error on Ubuntu 14.04 LTS installed from PPA. I downgraded and holded the packages @bzamecnik referenced but then cannot install certbot due to dependencies not met. This is exactly why I hate Python, suffers massively from dependency hell... Unfortunately on this server the kernel is too old to run Docker. Any ideas? |
@colinmollenhour Upgrade kernel and/or distro to 18.04 LTS? |
Thanks, @OlafvdSpek that would probably work but I shouldn't have to upgrade a supported OS just because of certbot... Finally got it working by installing certbot via |
You shouldn't but... ;) |
This worked for me as well. I had awscli installed via pip, but had to downgrade requests library as follows:
After this, awscli and certbot both worked. This is all on Ubuntu 16.04.05 LTS You must be careful about automatic future updates (i.e.
Later, you can remove the hold by using |
On EC2, installing pip3 install requests==2.12 |
Came across this in Jan of 2019. I fixed this for AWS Lightsail Ubuntu 16.04 [LAMP (PHP 7) 7.1.20-1] by applying @fsateler fix. Note: certbot version 0.28.0-1+ubuntu16.04.1+certbot+4 no upgrade at this time. Edit awsrequest.py around line 252 The full code change I applied can see seen at https://github.com/boto/botocore/pull/1259/files After making this change, renewal worked and the error "AttributeError: 'AWSHTTPSConnection' object has no attribute 'ssl_context'" went away. |
Hi,
I'm getting the above error when trying to use Route53 service. I have investigated and concluded that the fault is the copying of functions from AWSHTTPConnection to AWSHTTPSConnection:
The problem is that this ends up overriding the
__init__
function too, so theVerifiedHTTPSConnection
constructor is never invoked. I don't know why this worked in the past, or why it has become a problem recently. I have locally patched that file to addand function.__name__ != '__init__'
to theif
above, and copied manually the constructor toAWSHTTPSConnection
(to invokeVerifiedHTTPSConnection
constructor). Things seem to work fine now.The text was updated successfully, but these errors were encountered: