在代理后面使用Go App Engine的问题

时间:2015-10-13 13:08:26

标签: google-app-engine go polymer

我正在尝试运行托管在https://github.com/googlesamples/cloud-polymer-go的示例应用程序,但是当在代理后面运行它时,我会收到以下错误:

$ goapp serve dispatch.yaml frontend/app.yaml backend/app.yaml
INFO     2015-10-13 13:04:19,461 devappserver2.py:763] Skipping SDK update check.
INFO     2015-10-13 13:04:19,526 api_server.py:205] Starting API server at: http://localhost:59441
INFO     2015-10-13 13:04:19,527 dispatcher.py:185] Starting dispatcher running at: http://localhost:8080
INFO     2015-10-13 13:04:19,529 dispatcher.py:197] Starting module "frontend" running at: http://localhost:8081
INFO     2015-10-13 13:04:19,534 dispatcher.py:197] Starting module "default" running at: http://localhost:8082
INFO     2015-10-13 13:04:19,534 admin_server.py:116] Starting admin server at: http://localhost:8000
INFO     2015-10-13 13:04:23,859 module.py:786] frontend: "GET / HTTP/1.1" 304 -
INFO     2015-10-13 13:04:23,870 module.py:786] frontend: "GET /elements/post-list.html HTTP/1.1" 304 -
INFO     2015-10-13 13:04:24,377 module.py:786] frontend: "GET /elements/post-service.html HTTP/1.1" 304 -
INFO     2015-10-13 13:04:24,377 module.py:786] frontend: "GET /elements/post-form.html HTTP/1.1" 304 -
INFO     2015-10-13 13:04:24,377 module.py:786] frontend: "GET /elements/post-card.html HTTP/1.1" 304 -
WARNING  2015-10-13 13:04:26,344 dispatcher.py:762] Skipping dispatch.yaml rules because /_ah/api/static/proxy.html is not a dispatchable path.
socket.error 101
Traceback (most recent call last):
  File "/home/robert/applib/appEngine/go_appengine/lib/cherrypy/cherrypy/wsgiserver/wsgiserver2.py", line 1302, in communicate
    req.respond()
  File "/home/robert/applib/appEngine/go_appengine/lib/cherrypy/cherrypy/wsgiserver/wsgiserver2.py", line 831, in respond
    self.server.gateway(self).respond()
  File "/home/robert/applib/appEngine/go_appengine/lib/cherrypy/cherrypy/wsgiserver/wsgiserver2.py", line 2117, in respond
    for chunk in response:
  File "/home/robert/applib/appEngine/go_appengine/google/appengine/tools/devappserver2/endpoints/endpoints_server.py", line 121, in __call__
    yield self.dispatch(request, start_response)
  File "/home/robert/applib/appEngine/go_appengine/google/appengine/tools/devappserver2/endpoints/endpoints_server.py", line 138, in dispatch
    start_response)
  File "/home/robert/applib/appEngine/go_appengine/google/appengine/tools/devappserver2/endpoints/endpoints_server.py", line 172, in dispatch_non_api_requests
    return dispatch_function(request, start_response)
  File "/home/robert/applib/appEngine/go_appengine/google/appengine/tools/devappserver2/endpoints/endpoints_server.py", line 212, in handle_api_static_request
    response, body = discovery_api.get_static_file(request.relative_url)
  File "/home/robert/applib/appEngine/go_appengine/google/appengine/tools/devappserver2/endpoints/discovery_api_proxy.py", line 113, in get_static_file
    connection.request('GET', path, None, {})
  File "/usr/lib/python2.7/httplib.py", line 979, in request
    self._send_request(method, url, body, headers)
  File "/usr/lib/python2.7/httplib.py", line 1013, in _send_request
    self.endheaders(body)
  File "/usr/lib/python2.7/httplib.py", line 975, in endheaders
    self._send_output(message_body)
  File "/usr/lib/python2.7/httplib.py", line 835, in _send_output
    self.send(msg)
  File "/usr/lib/python2.7/httplib.py", line 797, in send
    self.connect()
  File "/usr/lib/python2.7/httplib.py", line 1178, in connect
    self.timeout, self.source_address)
  File "/usr/lib/python2.7/socket.py", line 571, in create_connection
    raise err
error: [Errno 101] Network is unreachable

变量:

$ echo $http_proxy 
http://asusis-isa2.personal.com.py:8080/
$ echo $https_proxy 
http://asusis-isa2.personal.com.py:8080/

设置正确。

我使用直接互联网连接。

我在Ubuntu 14.04下。

1 个答案:

答案 0 :(得分:2)

编辑看起来SDK中存在使用带URLFetch的代理的缺陷。

https://code.google.com/p/googleappengine/issues/detail?id=544

尝试设置这些环境变量的大写版本HTTP_PROXYHTTPS_PROXYgcloud launcher要求他们这样,所以我假设goapp也这样做。

  

使用HTTP代理

     

如果您在HTTP代理后面运行gcloud预览应用程序,则必须   告诉gcloud预览应用程序代理的名称。设置HTTP代理   对于gcloud预览应用程序,请设置http_proxy和https_proxy环境   变量。请注意,您必须指定app.yaml的完整路径   文件。

     

使用Windows(在命令提示符下):

$ set HTTP_PROXY=http://cache.mycompany.com:3128
$ set HTTPS_PROXY=http://cache.mycompany.com:3128
$ gcloud preview app deploy DIRECTORY/app.yaml
     

在Mac OS X(终端中)或Linux中使用命令行:

$ export HTTP_PROXY="http://cache.mycompany.com:3128"
$ export HTTPS_PROXY="http://cache.mycompany.com:3128"
$ gcloud preview app deploy DIRECTORY/app.yaml