Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using GCS in GAE Local devserver

Yesterday this code was working fine both in local and production servers:

import cloudstorage

def filelist(Handler):
    gs_bucket_name="/bucketname"
    list=cloudstorage.listbucket(gs_bucket_name)
    logging.warning(list)
    self.write(list)
    for e in list:
        self.write(e)
        self.write("<br>")

From yesterday to today I've upgraded GAE Launcher and changed the billing options (I was using a free trial and now a paid account) (not sure if it has anything to do, but just to give extra information)

But today the code stopped working in local (works fine in production)

This is the beginning of the error log

WARNING  2015-02-20 09:50:21,721 admin.py:106] <cloudstorage.cloudstorage_api._Bucket object at 0x10ac31e90>

ERROR    2015-02-20 09:50:21,729 api_server.py:221] Exception while handling service_name: "app_identity_service"
method: "GetAccessToken"
request: "\n7https://www.googleapis.com/auth/devstorage.full_control"
request_id: "WoMrXkOyfe"

The warning shows a bucket object, but as soon as I try to iterate in the list I get the exception on the identity service.

What is hapening? Seems that I need to authorize local devserver gcs mockup, but I'm not sure how.

Remember this is only happening in devserver, not in production.

Thanks for your help

like image 944
unaiherran Avatar asked Feb 20 '15 10:02

unaiherran


3 Answers

This is a problem with the latest release (1.9.18). For now, until it gets fixed, you can downgrade to 1.9.17 by downloading the installer from here and just running it: https://storage.googleapis.com/appengine-sdks/featured/GoogleAppEngineLauncher-1.9.17.dmg

As per the answer below, the 1.9.18 has been patched with a fix for this. If you still want to install the 1.9.17 version, please follow this link: https://storage.googleapis.com/appengine-sdks/deprecated/1917/GoogleAppEngineLauncher-1.9.17.dmg

like image 52
kioleanu Avatar answered Oct 31 '22 03:10

kioleanu


It's a known bug in the dev_appserver, where the SDK does not cope with the credentials already persisted in earlier versions. For me (on Ubuntu 15.10 with SDK 1.9.33) it helped to simply remove a file:

rm ~/.config/gcloud/application_default_credentials.json

as suggested in the bug issue filed by Jari Wiklund.

like image 32
Iwan LD Avatar answered Oct 31 '22 03:10

Iwan LD


Update: As of March 5th, 2105 this was fixed in the public release of 1.9.18, which may be a simpler way to get the fix.

Note: while the fix was in Python, issue can surface in Java, PHP and Go also because they use the Python local dev server code.

like image 1
Anthony Moore Avatar answered Oct 31 '22 03:10

Anthony Moore