Traceback (most recent call last):
File "/Users/timchen/.virtualenvs/pyenv3/lib/python3.7/site-packages/gunicorn/workers/sync.py", line 135, in handle
self.handle_request(listener, req, client, addr)
File "/Users/timchen/.virtualenvs/pyenv3/lib/python3.7/site-packages/gunicorn/workers/sync.py", line 176, in handle_request
respiter = self.wsgi(environ, resp.start_response)
File "/Users/timchen/.virtualenvs/pyenv3/lib/python3.7/site-packages/flask/app.py", line 2309, in __call__
return self.wsgi_app(environ, start_response)
File "/Users/timchen/Projects/project/utils/custom_middleware.py", line 12, in __call__
return self.app(environ, start_response)
File "/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/contextlib.py", line 119, in __exit__
next(self.gen)
File "/Users/timchen/.virtualenvs/pyenv3/lib/python3.7/site-packages/google/cloud/ndb/client.py", line 176, in context
context.eventloop.run()
File "/Users/timchen/.virtualenvs/pyenv3/lib/python3.7/site-packages/google/cloud/ndb/_eventloop.py", line 355, in run
if not self.run1():
File "/Users/timchen/.virtualenvs/pyenv3/lib/python3.7/site-packages/google/cloud/ndb/_eventloop.py", line 344, in run1
delay = self.run0()
File "/Users/timchen/.virtualenvs/pyenv3/lib/python3.7/site-packages/google/cloud/ndb/_eventloop.py", line 313, in run0
if self._run_current() or self.run_idle():
File "/Users/timchen/.virtualenvs/pyenv3/lib/python3.7/site-packages/google/cloud/ndb/_eventloop.py", line 278, in run_idle
result = callback(*args, **kwargs)
File "/Users/timchen/.virtualenvs/pyenv3/lib/python3.7/site-packages/google/cloud/ndb/_batch.py", line 62, in idle
batch.idle_callback()
File "/Users/timchen/.virtualenvs/pyenv3/lib/python3.7/site-packages/google/cloud/ndb/_cache.py", line 67, in idle_callback
cache_call = self.make_call()
File "/Users/timchen/.virtualenvs/pyenv3/lib/python3.7/site-packages/google/cloud/ndb/_cache.py", line 261, in make_call
cache = context_module.get_context().global_cache
File "/Users/timchen/.virtualenvs/pyenv3/lib/python3.7/site-packages/google/cloud/ndb/context.py", line 65, in get_context
raise exceptions.ContextError()
google.cloud.ndb.exceptions.ContextError: No current context. NDB calls must be made in context established by google.cloud.ndb.Client.context.
We are running this in a Flask application with custom middleware to instantiate client context. Calls made without transactional decorator work properly. We've tried decorating class, static, instance and standalone functions as well as closures with no success all resulting in the same traceback.
Environment details
ndb version: 0.1.0
Code example
Stack trace
We are running this in a Flask application with custom middleware to instantiate client context. Calls made without transactional decorator work properly. We've tried decorating class, static, instance and standalone functions as well as closures with no success all resulting in the same traceback.