question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

KeyError: 'path' intermittent error

See original GitHub issue

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.0 google-api-python-client==1.7.7 google-auth==1.6.1 google-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()

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:4
  • Comments:15 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
yuri-wisestampcommented, Mar 6, 2019

Clearing app engine cache fixed it for me. Are we expected to have more of this breaking awesomeness any time soon?

2reactions
salvador-byndcommented, Mar 4, 2019

Clearing the App engine memcache solved the issue. Will keep an eye on it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python KeyError Exceptions and How to Handle Them
Python's official documentation says that the KeyError is raised when a mapping key is accessed and isn't found in the mapping. A mapping...
Read more >
KeyError 'PATH' when running script from cron - Stack Overflow
I have a Python script that works when run from the normal Terminal (and from any location) but fails when running from cron,...
Read more >
How to fix “Nessus failed to load the SSH private key” error?
You have generated the keys correctly, placed the public key on a remote server. You can connect to this server using the private...
Read more >
How do I troubleshoot Lambda function failures? - AWS
To troubleshoot Lambda networking errors. 1. Confirm that there's a valid network path to the endpoint that your function is trying to reach ......
Read more >
Error codes in Device Manager in Windows - Microsoft Support
If updating the driver does not work, see your hardware documentation for more information. Note You may be prompted to provide the path...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found