Announcements
This site is in read only until July 22 as we migrate to a new platform; refer to this community post for more details.
Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Devappserver: Attempted RPC call without active security ticket

We're migrating from webapp2 to the latest version of Django. We want to keep using legacy services like Appengine NDB for now before we move to the latest technologies.

For running the development environment locally I am using devappserver inside a docker environment because devappserver doesn't work with python3 according to Google.

My Google Cloud SDK version inside docker container is: 424.0.0

The server runs, but I keep getting this error whenever I try to access a View that uses some sort of legacy service:

google.appengine.runtime.apiproxy_errors.RPCFailedError: Attempted RPC call without active security ticket

Error log:
errors.png


The app.yaml (for deployment looks like this):

runtime: python38
instance_class: F2
app_engine_apis: 'True'

entrypoint: bash -c 'python3 manage.py migrate --settings=conf.settings.dev --noinput && gunicorn -b :$PORT main:app'

handlers:
- url: /static
static_dir: static/

- url: /.*
script: auto
secure: always
redirect_http_response_code: 301

builtins:
- deferred: on


env_variables:
DEBUG: 'False'
DB_HOST:
DB_PORT:
DB_NAME:
DB_USER:
DB_PASSWORD:
DJANGO_SETTINGS_MODULE: conf.settings.dev

main.py:

from conf.wsgi import application
from google.appengine.api import wrap_wsgi_app

app = wrap_wsgi_app(application, use_legacy_context_mode=True, use_deferred=False)

The Django app works as expected when deployed to AppEngine Standard Environment. There is no error when running services inside the docker containers locally.

The package that I'm using for app engine bundled legacy service: Legacy Bundled Services

Example view:

from django.views import View
from django.http import JsonResponse

from google.appengine.api import memcache

class UserView(View):
def get(self, request):
memcache.set("Globe", "Jupiter")
return JsonResponse({'hello': memcache.get("Globe")})

I have tried these approaches and failed to resolve the error:

  • Tried creating a appengine_config.py file but apparently that doesn't work
  • Created a middleware to use AppEngine NDB using this middleware as a base (had to update it since latest django doesn't use MIDDLEWARE_CLASSES): google.appengine.ext.ndb.django_middleware.NdbDjangoMiddleware
  • Performed authentication using gcloud auth activate-service-account --key-file=/app/conf/gcp_credentials.json and setting project id
  • Configuring this env: GOOGLE_CLOUD_PROJECT
  • Tried creating a separate container in docker using the old google cloud SDK i.e. 183.0.0 for using the datastore emulator
0 4 837
4 REPLIES 4

marcanthonyb
Former Googler

Hi @hassan-arrivy ,

There's already a public issue tracker regarding that issue. You may check it out here.


Regards,
Marc 

I have solved the issue by using a patch. However, the issue that you provided is unrelated to this problem.

Do you mind sharing your patch? I will try to take a look and fix.

Here's the patch: https://github.com/NoCommandLine/dev_appserver-python3-windows. It's not my patch however I was able to apply this patch on google cloud SDK version 422 and it worked fine. I'm still curious why DevAppserver doesn't work in a Docker container.