Dewiniaeth
Dewiniaeth

Reputation: 1123

Google Cloud Endpoint 404 after deployment

Now that Google Cloud Endpoints have been opened up to all developers, I have created a Google Cloud Endpoint which works run a run locally in Eclipse debugging. But when I deploy, the live endpoint just returns an HTTP 404. My project's JSP pages run both locally and deployed. It's just the endpoints the don't work once deployed.

Anybody got any idea what I need to do to deploy cloud endpoints?

Upvotes: 6

Views: 5215

Answers (8)

Chris Halcrow
Chris Halcrow

Reputation: 31950

To add to the accepted answer, if your API is written in Java, and you're using Maven you can auto-generate an API version by adding this to your configuration for the appengine-maven-plugin. When deployed, the version number will be automatically updated, and the deployed version will be set as the only current running version of your API:

  <plugin>
    <groupId>com.google.cloud.tools</groupId>
    <artifactId>appengine-maven-plugin</artifactId>
    <version>${appengine.maven.plugin.version}</version>
    <configuration>
      <deploy.projectId>my-gcp-project-name</deploy.projectId>
      <deploy.version>GCLOUD_CONFIG</deploy.version>
    </configuration>
  </plugin>

The relevant line is <deploy.version>GCLOUD_CONFIG</deploy.version> (GCLOUD_CONFIG is the actual value you need - it's recognised as a special variable when you deploy)


Upvotes: 0

Eliot
Eliot

Reputation: 2429

As of App Engine 1.7.7 and earlier, this could also have been caused by forgetting to add your Endpoint class to web.xml like so:

<servlet>
    <servlet-name>SystemServiceServlet</servlet-name>
    <servlet-class>com.google.api.server.spi.SystemServiceServlet</servlet-class>
    <init-param>
        <param-name>services</param-name>
        <!-- Careful! No whitespace but commas between class names. -->
        <param-value>ditto.api.CategoryEndpoint,ditto.api.PostEndpoint</param-value>
    </init-param>
</servlet>

Upvotes: 0

davibq
davibq

Reputation: 1099

I got this issue and my problem was I didnt generate the "Cloud Endpoint Cloud Library" in eclipse.

Once I did it, everything worked perfectly.

Upvotes: 0

Dewiniaeth
Dewiniaeth

Reputation: 1123

I discovered that even though I only have one version (v1) deployed and that version was indicated as the "default" version in the app engine management console, I still had to "set" v1 as default before the API was accessible.

Upvotes: 12

Lars Christoffersen
Lars Christoffersen

Reputation: 1739

It is the V2 that is wrong. The API version does not increase with the Appengine version! These are two different versions. Try with version 1.

Upvotes: 0

Jun Yang
Jun Yang

Reputation: 76

Endpoints only supports APIs on the default app version right now.

Upvotes: 2

Chemist
Chemist

Reputation: 11

I have noticed that you have to access your endpoint by making the version you deployed the default version. For example https://yourappid.appspot.com/_ah/api/path/v2/methodname. If you use https://someappversion.yourappid.appspot.com/_ah/api/path/v2/methodnamel, it will not work based on my experience

Upvotes: 1

Lord Khizir
Lord Khizir

Reputation: 11

Have you tried to access them through the API explorer?

I had the same issue yesterday... Just happened to be using the wrong address.

Upvotes: 0

Related Questions