google-api-python-client: KeyError: 'path' intermittent error
We’ve been facing an intermittent error when trying to use oauth2 services. It was working fine until we deployed a new version on GAE. Notice that we haven’t changed anything related to this code or the google libraries versions.
That’s the exception:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1813, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1799, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "./route/auth.py", line 37, in google_auth_callback
user = service.userinfo().get().execute()
File "/usr/local/lib/python2.7/site-packages/googleapiclient/discovery.py", line 1121, in methodResource
schema=schema)
File "/usr/local/lib/python2.7/site-packages/googleapiclient/discovery.py", line 1026, in __init__
self._set_service_methods()
File "/usr/local/lib/python2.7/site-packages/googleapiclient/discovery.py", line 1061, in _set_service_methods
self._add_basic_methods(self._resourceDesc, self._rootDesc, self._schema)
File "/usr/local/lib/python2.7/site-packages/googleapiclient/discovery.py", line 1091, in _add_basic_methods
methodName, methodDesc, rootDesc, schema)
File "/usr/local/lib/python2.7/site-packages/googleapiclient/discovery.py", line 712, in createMethod
maxSize, mediaPathUrl) = _fix_up_method_description(methodDesc, rootDesc, schema)
File "/usr/local/lib/python2.7/site-packages/googleapiclient/discovery.py", line 580, in _fix_up_method_description
path_url = method_desc['path']
KeyError: 'path'
Environment details
- OS: Google App Engine Flexible,
debian:stretch-slim
docker image - Python version: 2.7.15
- pip version: 19.0.3
- versions:
google-api-core
==1.6.0google-api-python-client
==1.7.7google-auth
==1.6.1google-auth-httplib2
==0.0.3
Steps to reproduce
That’s the code, the error raises from service.userinfo().get().execute()
.
The error is intermittent and I haven’t figured out an specific scenario.
import httplib2
from googleapiclient.discovery import build
from oauth2client.client import AccessTokenCredentials
credentials = AccessTokenCredentials(<SOME ACCESS TOKEN>,
user_agent=str(request.user_agent))
http = httplib2.Http()
http = credentials.authorize(http)
service = build("oauth2", "v2", http=http, developerKey=<MY API KEY>)
user = service.userinfo().get().execute()
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 4
- Comments: 15 (3 by maintainers)
Clearing app engine cache fixed it for me. Are we expected to have more of this breaking awesomeness any time soon?
Clearing the App engine memcache solved the issue. Will keep an eye on it.
That’s interesting, my application does not use GAE’s memcache. It may be used by some internal GAE stuff…