InternalError(5:) on rest_api.py
Closed this issue · 1 comments
fcaldas commented
Hi,
I am having problems using this library, I did a very simple python program to list files in my bucket and I am getting an unexpected error, the same happens when trying to read files from a bucket.
Code
# -*- coding: utf-8 -*-
from google.appengine.ext import deferred
from google.appengine.ext import ndb
import logging
import os
import cloudstorage as gcs
import webapp2
from google.appengine.api import app_identity
class Handler(webapp2.RequestHandler):
def get(self):
bucket_name = os.environ.get('BUCKET_NAME',
app_identity.get_default_gcs_bucket_name())
self.response.headers['Content-Type'] = 'text/plain'
self.response.write('Demo GCS Application running from Version: '
+ os.environ['CURRENT_VERSION_ID'] + '\n')
self.response.write('Using bucket name: ' + bucket_name + '\n\n')
ll = gcs.listbucket ("/" + bucket_name)
for i in ll:
self.response.write(i + " \n");
#gcs_file = gcs.open("mylist.csv", mode="r")
#line = gcs_file.readline()
#self.response.write(line)
app = webapp2.WSGIApplication([('/view', Handler)])
Output on logs:
Traceback (most recent call last):
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1535, in __call__
rv = self.handle_exception(request, response, e)
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1529, in __call__
rv = self.router.dispatch(request, response)
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1278, in default_dispatcher
return route.handler_adapter(request, response)
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1102, in __call__
return handler.dispatch()
File "/base/data/home/runtimes/python27/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/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 570, in dispatch
return method(*args, **kwargs)
File "/base/data/home/apps/e~xxxdb-test/v1.394782655728550693/viewer.py", line 92, in get
for i in ll:
File "/base/data/home/apps/e~xxxdb-test/v1.394782655728550693/cloudstorage/cloudstorage_api.py", line 544, in __iter__
status, resp_headers, content = self._get_bucket_fut.get_result()
File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/ext/ndb/tasklets.py", line 383, in get_result
self.check_success()
File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/ext/ndb/tasklets.py", line 427, in _help_tasklet_along
value = gen.throw(exc.__class__, exc, tb)
File "/base/data/home/apps/e~xxxdb-test/v1.394782655728550693/cloudstorage/storage_api.py", line 128, in do_request_async
deadline=deadline, callback=callback)
File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/ext/ndb/tasklets.py", line 427, in _help_tasklet_along
value = gen.throw(exc.__class__, exc, tb)
File "/base/data/home/apps/e~xxxdb-test/v1.394782655728550693/cloudstorage/rest_api.py", line 198, in do_request_async
follow_redirects=False)
File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/ext/ndb/tasklets.py", line 427, in _help_tasklet_along
value = gen.throw(exc.__class__, exc, tb)
File "/base/data/home/apps/e~xxxdb-test/v1.394782655728550693/cloudstorage/api_utils.py", line 188, in run
raise e
InternalError: 5:
Does anyone has an idea of what I could do to solve that? Or has anyone else experienced similar issues?
Thanks in advance
fcaldas commented
I believe the issue is related with the fact that the user {project-id}@appspot.gserviceaccount.com does not exist in my app and I am not able to add it back to my project. So this is not an issue on cloudstorage.