我们已经在我们的应用程序中成功使用 Endpoints V1 几年了。现在,当尝试迁移到 Endpoints V2 时,它突然因为找不到 EndpointsServlet 而突然刹车,并且总是返回 404。
- 我可以使用 https://apis-explorer.appspot.com/apis-explorer/ 浏览 api
- 我可以看到请求到达后端以及我正在使用的一个过滤器
- 但它从未找到/到达 EndpointsServlet 或任何端点
- 奇怪的是它在本地主机开发服务器上工作??
这仍然是一个已知问题(对于某些应用程序)或者我该如何解决该问题?
404 响应如下所示:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "notFound",
"message": "\u003chtml\u003e\u003chead\u003e\n\u003cmeta http-equiv=\"content-type\" content=\"text/html;charset=utf-8\"\u003e\n\u003ctitle\u003e404 Not Found\u003c/title\u003e\n\u003c/head\u003e\n\u003cbody text=#000000 bgcolor=#ffffff\u003e\n\u003ch1\u003eError: Not Found\u003c/h1\u003e\n\u003c/body\u003e\u003c/html\u003e\n"
}
],
"code": 404,
"message": "\u003chtml\u003e\u003chead\u003e\n\u003cmeta http-equiv=\"content-type\" content=\"text/html;charset=utf-8\"\u003e\n\u003ctitle\u003e404 Not Found\u003c/title\u003e\n\u003c/head\u003e\n\u003cbody text=#000000 bgcolor=#ffffff\u003e\n\u003ch1\u003eError: Not Found\u003c/h1\u003e\n\u003c/body\u003e\u003c/html\u003e\n"
}
}
最佳答案
解决方案是在使用 Endpoints V2 部署应用程序时使用全新的未使用的版本名称,而不是:
https://test-dot-[app_id].appspot.com (this used previously Endpoints V1)
使用全新的版本名称,例如
https://test-new-dot-[app_id].appspot.com
正如这里所说:https://cloud.google.com/endpoints/docs/known-issues
"...you must currently deploy to a new App Engine app version. Reusing an old app version may conflict with the old Endpoints deployment..."
关于google-app-engine - 迁移到 Google Endpoints V2 后出现 404,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49133695/