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).
With endpointV1: no problem.
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.
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:
"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" }
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>
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:
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
When deploying a new type endpoint (v2), eg 2-dot-, it depends on the last V1 endpoint deployed on the version.
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.
The short answer for me was: do not reuse version names that were previously used with endpointV1.
E.g. I had a
testing-dot-MYPROJECT.appspot.com
.I now use a different version:
test-dot-MYPROJECT.appspot.com
.For the long answer, have a look at cputoaster's answer.