Search code examples
python-2.7google-app-engineinternal-server-error

Diagnosing an Internal Server Error in GAE


    Traceback (most recent call last):
      File "/base/alloc/tmpfs/dynamic_runtimes/python27/a7637d5531ec9deb_unzipped/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1535, in __call__
        rv = self.handle_exception(request, response, e)
      File "/base/alloc/tmpfs/dynamic_runtimes/python27/a7637d5531ec9deb_unzipped/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1529, in __call__
        rv = self.router.dispatch(request, response)
      File "/base/alloc/tmpfs/dynamic_runtimes/python27/a7637d5531ec9deb_unzipped/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1278, in default_dispatcher
        return route.handler_adapter(request, response)
      File "/base/alloc/tmpfs/dynamic_runtimes/python27/a7637d5531ec9deb_unzipped/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1102, in __call__
        return handler.dispatch()
      File "/base/alloc/tmpfs/dynamic_runtimes/python27/a7637d5531ec9deb_unzipped/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 572, in dispatch
        return self.handle_exception(e, self.app.debug)
      File "/base/alloc/tmpfs/dynamic_runtimes/python27/a7637d5531ec9deb_unzipped/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 570, in dispatch
        return method(*args, **kwargs)
      File "/base/data/home/apps/s~dkc-app/20180221t133719.407817416956265792/manage/admin.py", line 13, in get
        applicants, applications = query.get_all_overview()
      File "/base/data/home/apps/s~dkc-app/20180221t133719.407817416956265792/manage/query.py", line 52, in get_all_overview
        applications = ndb.get_multi(application_keys)
      File "/base/alloc/tmpfs/dynamic_runtimes/python27/a7637d5531ec9deb_unzipped/python27_lib/versions/1/google/appengine/ext/ndb/model.py", line 3931, in get_multi
        for future in get_multi_async(keys, **ctx_options)]
      File "/base/alloc/tmpfs/dynamic_runtimes/python27/a7637d5531ec9deb_unzipped/python27_lib/versions/1/google/appengine/ext/ndb/model.py", line 3916, in get_multi_async
        return [key.get_async(**ctx_options) for key in keys]
    AttributeError: 'NoneType' object has no attribute 'get_async'

This suddenly started happening a few weeks ago and I have not been able to figure out what happened. My best guess is that updating gcloud components caused it since nothing else changed.


Solution

  • try changing:

    applications = ndb.get_multi(application_keys)
    

    to

    applications = ndb.get_multi([key for key in application_keys if key])
    

    it looks like one of your keys is None