GAE cloud endpoints - Api not updating after deploy

jrmerz picture jrmerz · Feb 24, 2013 · Viewed 12.9k times · Source

I'm starting to use cloud endpoints in my GAE project but have been running into issues with the api not updating on the server.

  • localhost:8888/_ah/api/explorer is ok.

But when I deploy, nothing changes.

  • myapp.appspot.com:8888/_ah/api/explorer is bad

Further investigation shows the url end points update example: https://myapp.appspot.com/_ah/api/myapp/v1/foo/list

But the loaded client api is still incorrect. example: gapi.client.load('myapp', 'v1', callback, url); gapi.client.myapp.foo.list();

If I changed the call from foo/list to foo/list2, the rest url would update, the api package would not.

Answer

bossylobster picture bossylobster · Feb 25, 2013

I'll try to cover the two cases people could run into:

Client Side:

The Google APIs Explorer web app aggressively caches, so you'll need to clear your cache or force a refresh when you update your API server side to see the changes in the client.

Server Side (In Deployed Production App Engine App):

If you're having deployment issues, there are two places to look when debugging:

  • Check your Admin Logs (https://appengine.google.com/adminlogs?&app_id=s~YOUR-APP-ID) after deployment. After a successful deployment of your application code, you should see the message:

    Completed update of a new default version
    

    and shortly after that you should see:

    Successfully updated API configuration
    

    If you this message indicates the API configuration update failed, you should deploy again. If said error is persistent, you should notify us of a bug. If you don't see any message about your API configuration, you should check that the path /_ah/spi/.* is explicitly named in your routing config (app.yaml for Python, web.xml for Java).

  • Check your Application Logs (https://appengine.google.com/logs?&app_id=s~YOUR-APP-ID) after deployment. After the deployment finishes, Google's API infrastructure makes a request to /_ah/spi/BackendService.getApiConfigs in your application so that your API configuration (as JSON) can be registered with Google's API infrastructure and all the discovery-related configs can be created. If this request does not complete with a 200, then your API changes will not show up since Google's API infrastructure will have nothing to register.

  • If you are consistently getting a 302 redirect for requests to /_ah/spi/BackendService.getApiConfigs, it is because you (or your generated API config) have specified a "bns adapter" that uses http: as the protocol in your API root, but your web.xml (Java) or app.yaml (Python) is required that paths through /_ah/spi are secure. This will make requests using http: as the protocol be redirected (using 302) to the same page with https: as the protocol. This was discussed on the Trusted Tester forum before going to Experimental.