App Engine 提供三種資源調度類型:基本、手動以及自動。Endpoints Frameworks 使用自動調整資源配置執行個體並不支援的背景執行緒。Endpoints Frameworks 必須與 Google 服務通訊,以進行配額檢查及回報 API 活動等工作。對於基本和手動資源調度執行個體,背景執行緒會執行通訊作業,以避免要求的執行速度變慢。但是自動調整資源配置執行個體並不支援背景執行緒。因此,系統會在要求期間與 Google 服務進行通訊。Endpoints Frameworks 仍然正常運作,但效能可能會降低。
Failed to parse the HTTP response as service configuration
com.google.api.config.ServiceConfigException: Failed to parse the HTTP response as service configuration
google-endpoints==4.8.0google-endpoints-api-management==1.11.1# Newer versions of rsa module are incompatible with Python 2.7rsa==4.5; python_version < '3'
其他要求請加在這些程式碼行「之後」。
在本機測試時,API 傳回 404 錯誤
問題:當您使用 dev_appserver.py 在本機測試 API 時,所有端點都傳回 404,但當您部署 API 至 App Engine 時,端點卻能正常回應。這個問題會出現在使用 Django-six 程式庫的應用程式中。
[[["容易理解","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-08 (世界標準時間)。"],[[["\u003cp\u003eEndpoints Frameworks version 2 has a maximum request timeout of 60 seconds for both Java and Python.\u003c/p\u003e\n"],["\u003cp\u003eMigrating to Endpoints Frameworks version 2 requires deploying to a new App Engine app to avoid routing issues with version 1 paths.\u003c/p\u003e\n"],["\u003cp\u003eAutomatic scaling instances may experience reduced performance with Endpoints Frameworks due to the lack of background thread support for handling communications with Google services.\u003c/p\u003e\n"],["\u003cp\u003eOpenAPI documents with paths containing trailing slashes are rejected by Cloud Endpoints, requiring their removal in method decorators or annotations.\u003c/p\u003e\n"],["\u003cp\u003eSpecific issues that can arise include import errors in Python from conflicts with the \u003ccode\u003eoauth2client\u003c/code\u003e package, and \u003ccode\u003e404\u003c/code\u003e errors when testing locally with the Django-six library, requiring specific workarounds.\u003c/p\u003e\n"]]],[],null,["# Known issues\n\nThis page contains known issues in Cloud Endpoints Frameworks.\n\nJava and Python\n---------------\n\nThis section describes known issues that affect both the Java and Python\nversions of Endpoints Frameworks.\n\n### Maximum request timeout\n\nFor APIs using Endpoints Frameworks version 2, the maximum request\ntimeout is 60 seconds.\n\n### Endpoints Frameworks migration\n\nWhen you migrate your API to Endpoints Frameworks version 2, you must\ndeploy your API to a new App Engine app. If you reuse the old\nApp Engine app, requests that begin with the version 1 path, `/_ah/spi`,\nmight get routed to the Endpoints Frameworks version 2 backend, which\nexpects paths to begin with `/_ah/api`.\n\n### Poor performance on automatic scaling instances\n\nApp Engine offers three scaling types: basic, manual, and automatic.\nEndpoints Frameworks uses background threads, which automatic scaling\ninstances don't support. Endpoints Frameworks must communicate with\nGoogle services to check quotas and report API activity, among other things. For\nbasic and manual scaling instances, a background thread performs this\ncommunication to avoid slowing down requests. Automatic scaling instances,\nhowever, don't support background threads. Instead, the communication with\nGoogle services happens during the request. Endpoints Frameworks still\nworks, but with potentially reduced performance.\n\nBecause of this issue, you might want to configure another scaling type.\nSee the following sections in the App Engine documentation:\n\n- [Python: Scaling types and instance classes](/appengine/docs/standard/python/how-instances-are-managed)\n- [Java: Scaling types and instance classes](/appengine/docs/standard/java/how-instances-are-managed)\n\n### Paths with trailing slashes aren't supported\n\nWhen you deploy an OpenAPI document by using `gcloud endpoints services deploy`,\nCloud Endpoints rejects OpenAPI documents that include paths with a trailing\nslash, for example: \n\n```\npaths:\n \"/echo/\":\n post:\n description: \"Echo back a given message.\"\n```\n\n\u003cbr /\u003e\n\nIn Endpoints Frameworks, you must remove the trailing slash\nin the Python method decorator or the Java method annotation.\n\nJava\n----\n\nThis section describes known issues in Endpoints Frameworks for Java.\n\n### Cloud Endpoints Frameworks for Java - version 1.0.14 or older\n\nIncludes an issue where new fields in the [Google Service Configuration](/service-infrastructure/docs/glossary#config) causes the Cloud Endpoints Frameworks Java library to fail when parsing the Service Config. The errors will similar to the following when using service configurations created after December 5th, 2024: \n\n Failed to parse the HTTP response as service configuration\n com.google.api.config.ServiceConfigException: Failed to parse the HTTP response as service configuration\n\nSee the [release notes](/endpoints/docs/endpoints-release-notes) for more information on upgrading to version 1.0.15 or later.\n\n### Legacy (v1) Java Endpoints Frameworks\n\nEndpoints Frameworks version 1 for Java has a bug that throws an\nexception when an enum is annotated. This issue is caused by a\ndependency on an old version of\n[Jackson](https://wikipedia.org/wiki/Jackson_(API)). To workaround this issue,\nyou must\n[migrate to Endpoints Frameworks version 2](/endpoints/docs/frameworks/java/migrating).\n\nPython\n------\n\nThis section describes known issues in Endpoints Frameworks for\nPython.\n\n### Error message: `ImportError: cannot import name locked_file`\n\nWhen you run `pip install` with a `requirements.txt` file, you might get an\n`ImportError: cannot import name locked_file` error message. The issue\nis caused when `pip` installs a version of the `oauth2client` package that is\nincompatible with `google-endpoints-api-management`. To workaround this issue,\nmake sure that the `google-endpoints` and `google-endpoints-api-management`\nlines appear first in your `requirements.txt` file, for example: \n\n google-endpoints==4.8.0\n google-endpoints-api-management==1.11.1\n # Newer versions of rsa module are incompatible with Python 2.7\n rsa==4.5; python_version \u003c '3'\n\nAdd other requirements *after* these lines.\n\n### API returns `404` errors when testing locally\n\nSymptom: All endpoints return `404` when you use `dev_appserver.py` to test your\nAPI locally, but when you deploy your API to App Engine, the\nendpoints respond as expected. This issue has been observed in applications\nthat use the\n[Django-six library](https://pypi.org/project/django-six/).\n\nThis issue is caused by a version conflict between the `python-future` library,\nwhich is included in both the Endpoints Frameworks for Python library\nand the Django-six library. The exact version of the Django-six library causing\nthe conflict is unknown at this time."]]