jrmerz
jrmerz

Reputation: 708

GAE cloud endpoints - Api not updating after deploy

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.

But when I deploy, nothing changes.

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.

Upvotes: 20

Views: 13552

Answers (6)

Bharat Sawnani
Bharat Sawnani

Reputation: 23

I had the same problem, and I checked the admin logs, other logs etc... but still my API wasn't updating to the latest version.

So I decided to check in the API code for the last method I had written (I am writing in Java 7). And I found out that GAE doesn't like statements like:

if (!blocked){ .... }

I switched that to:

if (blocked == false) { ... }

And it worked like a charm. So by the looks of it, GAE scans the new API methods and doesn't accept some shortcuts.

Upvotes: 0

Ashish Awasthi
Ashish Awasthi

Reputation: 1327

I was also getting stale API discovery doc after deploying new version, it took a couple of minutes for GAE to start serving the new one to me.

Upvotes: 0

user2292916
user2292916

Reputation: 261

I had the same error Not Found (the 404 error code) when I was calling my API using this URL

https: // MY_APP_ID.appspot.com / _ah / api / MY_SERVICE / v1 / user

I tried everything and finally fixed it by removing the discovery files from WEB-INF and kept only MY_SERVICE-v1.api and then redeployed the API. It works fine now.

Upvotes: 0

demarcom
demarcom

Reputation: 131

This is what happened to me.

I tested my endpoint on localhost and it worked fine.

I deployed my endpoint on appspot and when I made requests to it I received in the browser the message 'Not found'.

So I looked in the logs and when I made requests to the endpoint I saw a 404 http error code on favicon file. And in effects I forgot to put that file in my deploy.

So I redeployed my war with the favicon file, the 404 http code disappeared and the endpoint worked fine on appspot too!

I realize that this may sound silly, but it is what I experienced. (I apologize for my poor english)

Upvotes: 2

Yaw Ly
Yaw Ly

Reputation: 11

I noticed that if you upload your app for the first time without the following in your web.xml:

 <security-constraint>
        <web-resource-collection>
            <url-pattern>/_ah/spi/*</url-pattern>
        </web-resource-collection>
        <user-data-constraint>
            <transport-guarantee>CONFIDENTIAL</transport-guarantee>
        </user-data-constraint>
    </security-constraint>

Then your bns adapter will be set as http going forward. When I add the above afterwards, I get 302 http code on /_ah/spi/BackendService.getApiConfigs and the endpoints never update.

So now I have reverted to not use https on /_ah/spi and my endpoints are updating. I guess for those that see their endpoints not being updated revert back to the first configuration they had for ssl on /_ah/spi/.

Yaw.

Upvotes: 1

bossylobster
bossylobster

Reputation: 10163

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.

Upvotes: 22

Related Questions