Google Cloud Storage is accessed by the App Engine UrlFetch
feature. As a result,
there are three sources of possible errors:
- App Engine UrlFetch transient errors.
- Google Cloud Storage transient errors.
- Google Cloud Storage errors related to buckets and object authorization.
The App Engine client library for Cloud Storage handles timeout errors on both the App Engine side and
the Google Cloud Storage side and performs retries automatically, so your app does not need to
add logic to handle this. The configuration of the timeout and retry mechanism
is exposed through the RetryParams
class, which you can use to change any or all of the default settings. You can
make your changes to apply to all function calls or you can specify changes for
a specific call using the function's retry_params
parameter.
Errors
The App Engine client library for Cloud Storage has the following error exception classes defined:
- cloudstorage.Error
-
The base class for all exceptions in this package. Errors can be generated from App Engine or from Google Cloud Storage. For details on HTTP error codes from Google Cloud Storage, see HTTP Status and Error Codes in the Google Cloud Storage documentation.
- cloudstorage.AuthorizationError
- An unauthorized request was received by Google Cloud Storage. This error can occur if an authorized app is using an access token that has expired. Normally, this error is handled automatically in the App Engine client library for Cloud Storage, which gets a new access token and retries the request.
- cloudstorage.ForbiddenError
This error (403) indicates that the user was not authorized by Google Cloud Storage to make the request.
- The various possible causes for this error are listed in the Google Cloud Storage error documentation for 403-Forbidden.
- A common source of this error is that the bucket permissions (bucket ACL) are not set properly to allow your app access. See Google Cloud Storage Authentication for information on setting up access.
- cloudstorage.NotFoundError
-
HTTP error 404. The bucket or object you specified in a call to
cloudstorage.delete()
,cloudstorage.listbucket()
,cloudstorage.open()
, orcloudstorage.stat()
does not exist. - cloudstorage.TimeoutError
- This error is raised when the attempt to contact Google Cloud Storage servers times out even after retry attempts. (See RetryParams for information on changing the default timeout handling and retries.