Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
843 views
in Technique[技术] by (71.8m points)

google app engine - Why is my API not showing up on deployment?

I suspect this is caused by the following bug in Endpoints (if valid) but I'm also sure there's a workaround somewhere.

https://code.google.com/p/googleappengine/issues/detail?id=9050&can=4&colspec=ID%20Type%20Component%20Status%20Stars%20Summary%20Language%20Priority%20Owner%20Log

Steps to reproduce:

  1. Change a method name, API name of a method, or parameter list in an Endpoints class.
  2. Run the endpoints.sh script to generate the API files.
  3. Inspect the API files locally and witness the changes being there. So far so good.
  4. Deploy to the default version of the app on the server.
  5. Check the logs for the call to /_ah/spi/BackendService.getApiConfigs. There are no errors!
  6. Go to API Explorer and clear the browser cache. Inspect the API. The change is not there.
  7. Request the API file directly in the browser, eg. https://[app-id].appspot.com/_ah/api/discovery/v1/apis/[api-name]/v1/rpc The change is not there.

Frustrated with the above, I decided to start completely from scratch on a new app ID. I still see no API in the API Explorer and get a 404 on the URL in step 7 above!

Here's my endpoint class:

@Api(name = "ditto", version = "v1")
public class CategoryEndpoint extends BaseEndpoint {

    @SuppressWarnings("unused")
    private static final Logger log = Logger.getLogger(CategoryEndpoint.class.getName());

    @ApiMethod(name = "category.list")
    public WireCategory list() {
        Category root = categoryDao.getRoot();
        WireCategory wireRootCategory = new WireCategory(root);

        return wireRootCategory;
    }

}

And here's the generated .api file:

{
  "extends" : "thirdParty.api",
  "abstract" : false,
  "root" : "https://1.eliot-dev-uk-ditto-do.appspot.com/_ah/api",
  "name" : "ditto",
  "version" : "v1",
  "defaultVersion" : false,
  "adapter" : {
    "bns" : "https://1.eliot-dev-uk-ditto-do.appspot.com/_ah/spi",
    "deadline" : 10.0,
    "type" : "lily"
  },
  "auth" : {
    "allowCookieAuth" : false
  },
  "frontendLimits" : {
    "unregisteredUserQps" : -1,
    "unregisteredQps" : -1,
    "unregisteredDaily" : -1,
    "rules" : [ ]
  },
  "cacheControl" : {
    "type" : "no-cache",
    "maxAge" : 0
  },
  "methods" : {
    "ditto.category.list" : {
      "path" : "list",
      "httpMethod" : "GET",
      "scopes" : [ ],
      "audiences" : [ ],
      "clientIds" : [ ],
      "rosyMethod" : "ditto.api.CategoryEndpoint.list",
      "request" : {
        "body" : "empty"
      },
      "response" : {
        "body" : "autoTemplate(backendResponse)"
      }
    }
  },
  "descriptor" : {
    "schemas" : {
      "WireCategory" : {
        "id" : "WireCategory",
        "type" : "object",
        "properties" : {
          "webSafePath" : {
            "type" : "string"
          },
          "prettyPath" : {
            "type" : "string"
          },
          "children" : {
            "type" : "array",
            "items" : {
              "$ref" : "WireCategory"
            }
          },
          "path" : {
            "type" : "array",
            "items" : {
              "type" : "string"
            }
          },
          "name" : {
            "type" : "string"
          },
          "id" : {
            "type" : "string",
            "format" : "int64"
          }
        }
      }
    },
    "methods" : {
      "ditto.api.CategoryEndpoint.list" : {
        "response" : {
          "$ref" : "WireCategory"
        }
      }
    }
  }
}

This URL gives me a 404 where I expect to see my API JSON:

https://eliot-dev-uk-ditto-do.appspot.com/_ah/api/discovery/v1/apis/ditto/v1

This is killing me!

EDIT:

Here's a diff I just spotted between the .api file generated by App Engine 1.7.5 and 1.7.6. Not sure why the URLs have changed.

ditto-v1.api from 1.7.6:

    {
      "extends" : "thirdParty.api",
      "abstract" : false,
      "root" : "https://1.eliot-dev-uk-ditto-do.appspot.com/_ah/api",
      "name" : "ditto",
      "version" : "v1",
      "defaultVersion" : false,
      "adapter" : {
        "bns" : "https://1.eliot-dev-uk-ditto-do.appspot.com/_ah/spi",
        "deadline" : 10.0,
        "type" : "lily"
      }
      ...

    ditto-v1.api from 1.7.5:

     {
      "extends" : "thirdParty.api",
      "abstract" : false,
      "root" : "https://eliot-dev-uk-ditto-do.appspot.com/_ah/api",
      "name" : "ditto",
      "version" : "v1",
      "defaultVersion" : false,
      "adapter" : {
        "bns" : "http://eliot-dev-uk-ditto-do.appspot.com/_ah/spi",
        "deadline" : 10.0,
        "type" : "lily"
      }
      ...
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...