22

最近,我将我的 GAE SDK 升级到了版本。1.7.4,当我尝试运行开发服务器时,它开始抛出“InvalidCertificateException”。我搜索了这个错误,有些人说它会随着时间的推移而消失,但我的没有。我应该研究什么来解决这个问题?我正在为我的应用程序使用 python 框架 Django,如果这很重要的话。

$ dev_appserver.py ./
INFO     2012-12-16 07:44:31,412 appcfg.py:586] Checking for updates to the SDK.
Traceback (most recent call last):
  File "/usr/local/bin/dev_appserver.py", line 171, in <module>
    run_file(__file__, globals())
  File "/usr/local/bin/dev_appserver.py", line 167, in run_file
    execfile(script_path, globals_)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver_main.py", line 747, in <module>
    sys.exit(main(sys.argv))
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver_main.py", line 680, in main
    update_check.CheckForUpdates()
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/appcfg.py", line 597, in CheckForUpdates
    runtime=self.config.runtime)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/appengine_rpc.py", line 391, in Send
    f = self.opener.open(req)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 394, in open
    response = self._open(req, data)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 412, in _open
    '_open', req)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 372, in _call_chain
    result = func(*args)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 1207, in https_open
    return self.do_open(httplib.HTTPSConnection, req)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/fancy_urllib/fancy_urllib/__init__.py", line 379, in do_open
    url_error.reason.args[1])
fancy_urllib.InvalidCertificateException: Host appengine.google.com returned an invalid certificate (_ssl.c:503: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed): 
To learn more, see http://code.google.com/appengine/kb/general.html#rpcssl
4

4 回答 4

39

我发现的快速解决方法:google_appengine/lib/cacerts/cacerts.txt从已安装的 SDK 中删除该文件。

从 GoogleAppEngineLauncher 开始:

GoogleAppEngineLauncher/Contents/Resources/GoogleAppEngineDefault.bundle/Content‌​s/Resources/google_appengine/lib/cacerts/cacerts.txt

编辑 #

从 google app engine SDK 1.8.1 开始,此文件已重命名为 urlfetch_cacerts.txt。仍然在同一目录中并删除它仍然可以解决问题。

– @哈里森

于 2013-01-28T15:50:11.617 回答
2

紧凑的答案,截至 2014 年 1 月(刚刚在 SDK 更新中幸存下来):

rm file /Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/cacerts/urlfetch_cacerts.txt

或者 ...

cd /Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/cacerts/
rm urlfetch_cacerts.txt

一切都再次顺利进行。

你最好也删除“cacerts.txt”(在同一目录中)。否则 sdk 命令行工具也会抛出异常:(

于 2014-01-16T09:13:24.973 回答
1

仅供参考:如果您在运行 Mavericks 的 Mac 上,此错误可能是由于使用了 python 2.7.6 或更低版本,它有一个导致此错误的已知错误。

例如,您会通过简单地尝试获取任何 SSL 页面得到类似的错误:

pip install requests
python

>>> import requests
>>> requests.get("https://github.com")

以上将产生相同的 SSL 证书错误。在这种情况下,gcloud(谷歌云 SDK)命令都不起作用。

升级到 python 2.7.8(或更新的 2.7.X)来解决问题(为我工作)。

于 2014-10-16T10:28:54.737 回答
0

将 Python 从 2.7.3 升级到 2.7.9 为我修复了它。我在 Mac OS X 10.6.8 (Snow Leopard) 上。

于 2015-02-25T06:26:21.343 回答