4

I'm developing a Google App Engine app with several modules. Back-end APIs utilize Google Cloud Endpoints. When I run the GAE server locally even though I load the APIs from my admin module (localhost:9090) after the client is loaded it tries to make the calls to the default module port (localhost:8080). On remote GAE instance everything works just fine. What can be the reason or workaround for that?

The code is:

function init() {
  var loadCallback = function () {
    gapi.client.adminapi.mymethod(12345).then(alert(Woohoo!));
  };

  var apiRoot = '//' + window.location.host + '/_ah/api';
  gapi.client.load('adminapi', 'v1', loadCallback, apiRoot);
}

1 Answer 1

2

Okay, the only answer that I've found and that worked as a workaround for non-default module in local GAE was described here: https://code.google.com/p/google-api-javascript-client/issues/detail?id=147

  1. Open localhost:8090/_ah/api/discovery/v1/apis/adminapi/v1/rest
  2. Download JSON
  3. Update List baseUrl and rootUrl to contain the right port (8090 in my case)
  4. Pass updated JSON in gapi.client.load function on client instead of name of the API

Alternative: Add to @Api annotated Java class: root = "http://localhost:8090/_ah/api", backendRoot = "http://localhost:8090/_ah/spi",

The only moment in these 2 approaches: I should not commit these changes as these URLs are surely not meant for production.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.