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"]],["最后更新时间 (UTC):2025-09-04。"],[[["\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."]]