Getting 403 status trying to work access a bucket in Google Cloud Storage from AppEngine

1,392 views
Skip to first unread message

Dario Iacampo

unread,
Jan 27, 2014, 9:58:15 AM1/27/14
to google-a...@googlegroups.com
In my appEngine application:
- cloud storage is turned on
- billing is enabled
- the app works great locally on the sdk

After I have deployed the app, as soon I try to access a bucket [ bucket_images = list(gcs.listbucket(bucket_name)) ] I get the 403 error:

Expect status [200] from Google Storage. But got status 403.
Path: u'/103996515_at_n07'.
Request headers: None.
Response headers: {'alternate-protocol': '443:quic', 'content-length': '111', 'via': 'HTTP/1.1 GWA', 'x-google-cache-control': 'remote-fetch', 'expires': 'Mon, 27 Jan 2014 14:41:25 GMT', 'server': 'HTTP Upload Server Built on Jan 16 2014 16:13:41 (1389917621)', 'cache-control': 'private, max-age=0', 'date': 'Mon, 27 Jan 2014 14:41:25 GMT', 'content-type': 'application/xml; charset=UTF-8'}.
Extra info: {'prefix': u'72157640214783015/458/257/2014-1-28'}.
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/s~flickr-random-gallery-cache/1.373348455585133908/main.py", line 78, in get
    bucket_images = list(gcs.listbucket(bucket_name))
  File "/base/data/home/apps/s~flickr-random-gallery-cache/1.373348455585133908/cloudstorage/cloudstorage_api.py", line 298, in __iter__
    extras=self._options)
  File "/base/data/home/apps/s~flickr-random-gallery-cache/1.373348455585133908/cloudstorage/errors.py", line 106, in check_status
    raise ForbiddenError(msg)
ForbiddenError: Expect status [200] from Google Storage. But got status 403.
Path: u'/103996515_at_n07'.
Request headers: None.
Response headers: {'alternate-protocol': '443:quic', 'content-length': '111', 'via': 'HTTP/1.1 GWA', 'x-google-cache-control': 'remote-fetch', 'expires': 'Mon, 27 Jan 2014 14:41:25 GMT', 'server': 'HTTP Upload Server Built on Jan 16 2014 16:13:41 (1389917621)', 'cache-control': 'private, max-age=0', 'date': 'Mon, 27 Jan 2014 14:41:25 GMT', 'content-type': 'application/xml; charset=UTF-8'}.
Extra info: {'prefix': u'72157640214783015/458/257/2014-1-28'}.

Vinny P

unread,
Jan 27, 2014, 2:15:28 PM1/27/14
to google-a...@googlegroups.com
On Mon, Jan 27, 2014 at 8:58 AM, Dario Iacampo <jnts...@gmail.com> wrote:
In my appEngine application:
- cloud storage is turned on
- billing is enabled
- the app works great locally on the sdk

After I have deployed the app, as soon I try to access a bucket [ bucket_images = list(gcs.listbucket(bucket_name)) ] I get the 403 error:

Expect status [200] from Google Storage. But got status 403

Hi Dario,

When you say the app is working locally, do you mean that your app is using the local Google Cloud Storage mocking service, or is actively connecting to Cloud Storage production and writing to it? 

403 means HTTP Forbidden, so there must be some sort of permissions problem. You can try adding your application ID as a service account to the bucket: I wrote up some directions here (the pics are for the old console, but it's easy to figure out) http://learntogoogleit.com/post/54528163872/setting-permissions-to-access-cloud-storage-from-app

You should also make sure that Cloud Storage access is activated in the APIs console: https://code.google.com/apis/console
 
 
-----------------
-Vinny P
Technology & Media Advisor
Chicago, IL

App Engine Code Samples: http://www.learntogoogleit.com
Reply all
Reply to author
Forward
0 new messages