GAE云端点 - Api部署后未更新 [英] GAE cloud endpoints - Api not updating after deploy

查看:116
本文介绍了GAE云端点 - Api部署后未更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始在GAE项目中使用云端点,但遇到了api未在服务器上更新的问题。


  • localhost:8888 / _ah / api / explorer即可。



但是当我部署时,没有任何变化。




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



进一步的调查显示,url结束点更新
例如:

但是加载的客户端api仍然不正确。
示例:gapi.client.load('myapp','v1',callback,url);
gapi.client.myapp.foo.list();

如果我将来自foo / list的调用更改为foo / list2,则其余url将更新,那么api包就不会。

我会尽力涵盖人们可能遇到的两种情况:



客户端:





服务器端(部署的生产App Engine应用程序):



如果您遇到部署问题,有两个地方查看调试时间:


  • 检查您的管理日志( https://appengine.google.com/adminlogs?&app_id=s~YOUR-APP-ID )。成功部署应用程序代码后,您应该看到以下消息:

     完成的新默认版本更新

    不久之后,您应该看到:

     成功更新API配置

    如果此消息指示API配置更新失败,你应该再次部署。如果所述错误持续存在,则应通知我们一个错误。如果您没有看到关于API配置的任何消息,则应检查路径配置中是否明确指定了路径 / _ ah / spi /.* app.yaml for Python, web.xml for Java)。


  • 检查您的应用程序日志( https:// appengine。 google.com/logs?&app_id=s~YOUR-APP-ID )。部署完成后,Google的API基础架构会在您的应用程序中向 / _ ah / spi / BackendService.getApiConfigs 发出请求,以便您的API配置(如JSON)可以通过Google可以创建API基础结构和所有与发现相关的配置。如果此请求没有填写200,那么您的API更改将不会显示,因为Google的API基础结构没有任何可注册的内容。

  • 如果您始终如一得到一个 302 重定向请求到 / _ ah / spi / BackendService.getApiConfigs ,这是因为你(或者你的生成的API config)指定了一个bns适配器,它使用 http:作为API根目录中的协议,但是 web.xml (Java)或 app.yaml (Python),通过 / _ ah / spi 的路径是安全的。这将使得使用 http:作为协议的请求被重定向(使用 302 )到 https:作为协议。在进入Trusted Tester论坛之前,进行了讨论实验。

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.

解决方案

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.

这篇关于GAE云端点 - Api部署后未更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆