Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deferred "Attempted RPC call without active security ticket" error #44

Closed
ZachOrr opened this issue Nov 21, 2021 · 4 comments
Closed

deferred "Attempted RPC call without active security ticket" error #44

ZachOrr opened this issue Nov 21, 2021 · 4 comments

Comments

@ZachOrr
Copy link

ZachOrr commented Nov 21, 2021

Expected Behavior

Enqueuing a deferred task

Actual Behavior

Attempting to enqueue a deferred task throws an error due to a missing security ticket.

Stack trace:

Traceback (most recent call last):
  File "/layers/google.python.pip/pip/lib/python3.8/site-packages/flask/app.py", line 2073, in wsgi_app
    response = self.full_dispatch_request()
  File "/layers/google.python.pip/pip/lib/python3.8/site-packages/flask/app.py", line 1518, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/layers/google.python.pip/pip/lib/python3.8/site-packages/flask/app.py", line 1516, in full_dispatch_request
    rv = self.dispatch_request()
  File "/layers/google.python.pip/pip/lib/python3.8/site-packages/flask/app.py", line 1502, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
  File "/workspace/backend/tasks_io/main.py", line 24, in test
    deferred.defer(do_the_thing)
  File "/layers/google.python.pip/pip/lib/python3.8/site-packages/google/appengine/ext/deferred/deferred.py", line 305, in defer
    return task.add(queue, transactional=transactional)
  File "/layers/google.python.pip/pip/lib/python3.8/site-packages/google/appengine/api/taskqueue/taskqueue.py", line 1292, in add
    return self.add_async(queue_name, transactional).get_result()
  File "/layers/google.python.pip/pip/lib/python3.8/site-packages/google/appengine/api/taskqueue/taskqueue.py", line 1288, in add_async
    return Queue(queue_name).add_async(self, transactional, rpc)
  File "/layers/google.python.pip/pip/lib/python3.8/site-packages/google/appengine/api/taskqueue/taskqueue.py", line 2139, in add_async
    return self.__AddTasks(tasks,
  File "/layers/google.python.pip/pip/lib/python3.8/site-packages/google/appengine/api/taskqueue/taskqueue.py", line 2278, in __AddTasks
    return _MakeAsyncCall('BulkAdd',
  File "/layers/google.python.pip/pip/lib/python3.8/site-packages/google/appengine/api/taskqueue/taskqueue.py", line 488, in _MakeAsyncCall
    rpc.make_call(method, request, response, get_result_hook, None)
  File "/layers/google.python.pip/pip/lib/python3.8/site-packages/google/appengine/api/apiproxy_stub_map.py", line 565, in make_call
    self.__rpc.MakeCall(self.__service, method, request, response)
  File "/layers/google.python.pip/pip/lib/python3.8/site-packages/google/appengine/api/apiproxy_rpc.py", line 133, in MakeCall
    self._MakeCallImpl()
  File "/layers/google.python.pip/pip/lib/python3.8/site-packages/google/appengine/runtime/default_api_stub.py", line 173, in _MakeCallImpl
    raise apiproxy_errors.RPCFailedError(
google.appengine.runtime.apiproxy_errors.RPCFailedError: Attempted RPC call without active security ticket

Steps to Reproduce the Problem

  1. Create a base Flask app with use_deferred=True

main.py

from flask import Flask
from google.appengine.api import wrap_wsgi_app

app = Flask(__name__)
app.wsgi_app = wrap_wsgi_app(app.wsgi_app, use_legacy_context_mode=False, use_deferred=True)


def do_the_thing():
    print(f"We did the thing")


@app.route('/')
def index():
    from google.appengine.ext import deferred

    deferred.defer(do_the_thing)

app.yaml

runtime: python38
entrypoint: gunicorn -b :$PORT main:app
app_engine_apis: true

handlers:
  - url: /.*
    script: auto
  1. Run the app
$ dev_appserver.py --runtime_python_path=$(which python3) app.yaml
  1. Navigate to http://localhost:8080/ in a browser - observe the error

Specifications

  • Version: v0.3.1
  • Platform: Ubuntu 20.04.3 (also replicated on an upstream GAE deploy)
@asriniva
Copy link
Contributor

At the moment the use_legacy_context_mode=True option is the only mode supported for the SDK. The newer context mode is being worked on but is not yet compatible with the Taskqueue API.

@ghost ghost deleted a comment Jan 3, 2022
@ghost ghost deleted a comment Jan 3, 2022
@ghost ghost deleted a comment Jan 3, 2022
@firerabbit
Copy link

I get this error locally with memcache and datastore as well, which use_legacy_context_mode=True and False and use_deferred=True and False. If I push this up to appengine the memcache read/write succeeds

@asriniva
Copy link
Contributor

Unless you're running devappserver or otherwise stubbing out the memcache/datastore services, the calls will not succeed locally. These App Engine services are not accessible outside the App Engine environment.

@hassan-arrivy
Copy link

@asriniva I'm running devappserver locally but these services still don't work. I'm using python38 with latest version of Django. We're in the migration process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants