在GAE上使用端点V2进行版本控制 [英] Versioning with endpoint V2 on GAE

查看:167
本文介绍了在GAE上使用端点V2进行版本控制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经部署了带有其端点的应用程序的实时版本(这没有问题). 我还希望能够轻松测试其他版本(例如登台).

I have the live version of my app deployed with its endpoints (no problem with that). I also want to easily be able to test other versions (e.g. staging).

使用endpointV1 :没问题.

使用endpointV2 : 如果我部署到实时版本,则一切正常(位于 https://[PROJECT-ID] .appspot. com ,但不适用于其他版本.

With endpointV2: Everything works fine if I deploy to the live version (at https://[PROJECT-ID].appspot.com but does not work for other versions.

部署到>://staging-dot- [PROJECT-ID ] .appspot.com 部署成功,但是当前端调用后端时,后端接收到了该请求(我可以在GAE日志和跟踪列表中看到它),但是并没有使其成功或通过endpointV2并响应404 NOT FOUND:

After deploying to staging at https://staging-dot-[PROJECT-ID].appspot.com the deployment is successful, but when the frontend calls the backend, the request is received by the backend (I can see it in the GAE logs and trace list), but it does not make it to or though endpointV2 and responds 404 NOT FOUND:

错误":[ { "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 }

"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" }

我现在使用以下Maven插件:

I now use the following maven plugins:

<plugin>
    <groupId>com.google.cloud.tools</groupId>
    <artifactId>appengine-maven-plugin</artifactId>
    <version>1.3.1</version>
    <configuration>
        <!-- deploy configuration -->
    </configuration>
</plugin>
<plugin>
    <groupId>com.google.cloud.tools</groupId>
    <artifactId>endpoints-framework-maven-plugin</artifactId>
    <version>1.0.0</version>
</plugin>

我已经调整了appengine.xml和Google Cloud插件中的版本.如何配置端点以使其与特定模块版本一起使用,而不是仅与主版本一起使用?

I have adjusted the versions in appengine.xml and in the Google Cloud plugin. How can I configure endpoint to work with a specific module version instead of only the main version?

推荐答案

虽然不是真正的答案,但我看到了:

While not really an answer, I saw this:

在部署旧式终结点(V1)时,一切正常,

When deploying a legacy type endpoint (V1), everything works fine, https://3-dot-xx.appspot.com/_ah/api/discovery/v1/apis will show the APIs deployed to version 3

在部署新型端点(v2)(例如2点)时,它取决于版本上部署的最后一个V1端点.

When deploying a new type endpoint (v2), eg 2-dot-, it depends on the last V1 endpoint deployed on the version.

  • 如果它是以前未部署V1终结点的新版本,则可以正常工作,并且新终结点显示在2点上.
  • 如果以前在此处部署了V1终结点,它将显示旧的V1 api并在访问时自然生成404,因为实际运行的GAE版本不同
  • 如果从未完全部署过该版本(例如asdf-dot-),或者使用默认版本(未使用-dot-等),它将显示默认版本并正确访问它.
  • 如果从未部署过V1服务,而是部署了V2服务,则在部署新的V2服务时可以正常工作

因此,如果您已经在其上运行了V1服务,则似乎存在一个错误,它将阻止您使用稳定名称来测试/暂存环境.如果Google的某人可以确认此错误并提出适当的解决方法,然后再进行很多昂贵的更改才能更改URL,这将非常有帮助.

So, it seems like there is a bug that will prevent you from using stable names for testing / staging environments if you already had a V1 service running on them. It would be very helpful if someone from Google could confirm this bug and suggest an appropriate workaround before I have to do a lot of costly changes to change URLs.

这篇关于在GAE上使用端点V2进行版本控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆