appcfg.py request_logs certificate verify failed (_ssl.c:661)

568 Views Asked by At

We've been using appcfg.py request_logs to download GAE logs, every once in a while it throws the error:

httplib2.SSLHandshakeError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:661)

But after a few times trying it works out, sometimes also it works after updating gcloud using gcloud components update. We thought it might be some network throttling issue of some kind and didn't give it enough thought. Lately though, we're trying to figure out what is causing this.

The full command we use is:

appcfg.py request_logs -A testapp --version=20180321t073239 --severity=0  all_logs.log --append --no_cookies

It seems the error is related to httplib2 library, but since it is part of the appcfg.py calls we're not sure we should tamper with something within its calls

Versions:

Python 2.7.13
Google Cloud SDK 196.0.0
app-engine-python 1.9.67
1

There are 1 best solutions below

0
On

This has become more persistent now and I couldn't download logs for a few days now no matter how many times I try.

Looking at the download logs command I tried the same command again but without the --no_cookies flag to see what would happen.

appcfg.py request_logs -A testapp --version=20180321t073239 --severity=0  all_logs.log --append

I got the error:

Error 403: --- begin server output ---
You do not have permission to modify this app (app_id=u'e~testapp').
--- end server output ---

Which lead me to the answer provided here https://stackoverflow.com/a/34694577/1394228 by @ninjahoahong. This worked for me and logs where downloaded from first trial in case someone faces the same issue

There's also this Google Group post which I didn't try but seems like it does the same thing.

Not sure if removing the file ~/.appcfg_oauth2_tokens would have other effects, yet to find out.

Update:

I also found out that my httplib2 located at /Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/httplib2 was version = "0.7.5", I upgraded it to version = '0.11.3' using target location(directory) upgrade command:

sudo pip2 install --upgrade httplib2 -t /Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/httplib2/