Python 2.7 はサポートが終了しており、2026 年 1 月 31 日に
非推奨になります。非推奨になると、過去に組織のポリシーを使用して以前のランタイムのデプロイを再度有効にしていた場合でも、Python 2.7 アプリケーションをデプロイできなくなります。既存の Python 2.7 アプリケーションは、
非推奨日以降も引き続き実行され、トラフィックを受信します。
サポートされている最新バージョンの Python に移行することをおすすめします。
Cloud Storage のエラーとエラー処理
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
Google Cloud Storage は、App Engine UrlFetch
機能によってアクセスされます。このため、次の 3 種類のエラーが発生します。
- App Engine UrlFetch の一時エラー。
- Google Cloud Storage の一時エラー。
- バケットとオブジェクト権限に関連する Google Cloud Storage エラー。
Cloud Storage 用 App Engine クライアント ライブラリは、App Engine と Google Cloud Storage の両方でタイムアウト エラーを処理し、自動的に再試行を行います。このエラーを処理するロジックをアプリに追加する必要はありません。タイムアウトと再試行の構成は RetryParams クラスで公開します。これにより、デフォルト設定の一部またはすべてを変更できます。すべての関数呼び出しに適用される変更を行うことも、関数の retry_params
パラメータを使用して特定の呼び出しに変更を行うこともできます。
エラー
Cloud Storage 用 App Engine クライアント ライブラリには、次のエラー例外クラスが定義されています。
- cloudstorage.Error
-
このパッケージのすべての例外の基本クラスです。このエラーは、App Engine または Google Cloud Storage で発生します。Google Cloud Storage の HTTP エラーコードの詳細については、Google Cloud Storage のドキュメントで HTTP ステータスとエラーコードの説明をご覧ください。
- cloudstorage.AuthorizationError
- Google Cloud Storage が未承認のリクエストを受信しました。このエラーは、承認済みのアプリが期限切れのトークンを使用すると発生します。通常、このエラーは Cloud Storage 用 App Engine クライアント ライブラリによって自動的に処理され、新しいアクセス トークンでリクエストが再試行されます。
- cloudstorage.ForbiddenError
このエラー(403)は、Google Cloud Storage でユーザーにリクエストの送信が許可されていないことを意味します。
- cloudstorage.NotFoundError
-
HTTP エラー 404。
cloudstorage.delete()
、cloudstorage.listbucket()
、cloudstorage.open()
、cloudstorage.stat()
の呼び出しで指定したバケットまたはオブジェクトが存在しません。
- cloudstorage.TimeoutError
-
このエラーは、再試行後に Google Cloud Storage サーバーとの接続がタイムアウトすると発生します。デフォルトのタイムアウト処理と再試行を変更する方法については、RetryParams をご覧ください。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-09-04 UTC。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["わかりにくい","hardToUnderstand","thumb-down"],["情報またはサンプルコードが不正確","incorrectInformationOrSampleCode","thumb-down"],["必要な情報 / サンプルがない","missingTheInformationSamplesINeed","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-09-04 UTC。"],[[["\u003cp\u003eThe App Engine client library for Cloud Storage handles timeout errors and retries automatically, eliminating the need for manual handling in your app.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eRetryParams\u003c/code\u003e class allows customization of timeout and retry settings, which can be applied globally or to specific function calls.\u003c/p\u003e\n"],["\u003cp\u003eErrors related to Google Cloud Storage access can stem from transient issues, or from bucket and object authorization, in addition to transient errors coming from App Engine \u003ccode\u003eUrlFetch\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003ecloudstorage\u003c/code\u003e library defines exception classes like \u003ccode\u003eError\u003c/code\u003e, \u003ccode\u003eAuthorizationError\u003c/code\u003e, \u003ccode\u003eForbiddenError\u003c/code\u003e, \u003ccode\u003eNotFoundError\u003c/code\u003e, and \u003ccode\u003eTimeoutError\u003c/code\u003e to handle various error scenarios.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eForbiddenError\u003c/code\u003e (403) is common when the bucket permissions (bucket ACL) are not configured properly to allow access from the application.\u003c/p\u003e\n"]]],[],null,["# Cloud Storage Errors and Error Handling\n\nGoogle Cloud Storage is accessed by the App Engine ` UrlFetch ` feature. As a result,\nthere are three sources of possible errors:\n\n- App Engine UrlFetch transient errors.\n- Google Cloud Storage transient errors.\n- Google Cloud Storage errors related to buckets and object authorization.\n\nThe App Engine client library for Cloud Storage handles timeout errors on both the App Engine side and\nthe Google Cloud Storage side and performs retries automatically, so your app does not need to\nadd logic to handle this. The configuration of the timeout and retry mechanism\nis exposed through the [RetryParams](/appengine/docs/legacy/standard/python/googlecloudstorageclient/retryparams_class)\nclass, which you can use to change any or all of the default settings. You can\nmake your changes to apply to all function calls or you can specify changes for\na specific call using the function's `retry_params` parameter.\n\nErrors\n------\n\nThe App Engine client library for Cloud Storage has the following error exception classes defined:\n\ncloudstorage.Error\n\n: The base class for all exceptions in this package. Errors can be\n generated from App Engine or from Google Cloud Storage. For details on HTTP\n error codes from Google Cloud Storage, see\n [HTTP Status and Error\n Codes](/storage/docs/reference-status#standardcodes) in the Google Cloud Storage documentation.\n\ncloudstorage.AuthorizationError\n: An unauthorized request was received by Google Cloud Storage. This error can occur if an\n authorized app is using an access token that has expired. Normally, this error\n is handled automatically in the App Engine client library for Cloud Storage, which gets a new access token\n and retries the request.\n\ncloudstorage.ForbiddenError\n\n: This error (403) indicates that the user was not authorized by Google Cloud Storage to\n make the request.\n\n - The various possible causes for this error are listed in the [Google Cloud Storage error\n documentation](/storage/docs/reference-status#standardcodes) for **403-Forbidden**.\n - 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](/storage/docs/authentication) for information on setting up access.\n\n \u003cbr /\u003e\n\ncloudstorage.NotFoundError\n:\n HTTP error 404. The bucket or object you specified in a call to\n `cloudstorage.delete()`, `cloudstorage.listbucket()`,\n `cloudstorage.open()`,\n or `cloudstorage.stat()` does not exist.\n\ncloudstorage.TimeoutError\n:\n This error is raised when the attempt to contact Google Cloud Storage servers times out even\n after retry attempts. (See\n [RetryParams](/appengine/docs/legacy/standard/python/googlecloudstorageclient/retryparams_class)\n for information on changing the default timeout handling and retries."]]