【问题标题】:gcloud endpoints deploy Error with timestamp typegcloud端点部署错误时间戳类型
【发布时间】:2018-04-05 09:47:52
【问题描述】:

我已经成功部署了很多谷歌 gRPC 云端点。

但是第一次,我在我的原型中使用时间戳类型,当我尝试部署我的 gRPC API 时,我遇到了一个错误:

gcloud endpoints deploy services api_descriptor.pb api_config.yaml

ERROR: (gcloud.endpoints.services.deploy) INVALID_ARGUMENT: Cannot 
convert to service config.
'ERROR: google/protobuf/timestamp.proto:121:1: (at document line 76) 
Unexpected end tag '--)' with missing begin tag.'

我的生成 api_descriptor.pb 的命令

protoc -I . backoffice*.proto \
--proto_path=. \
--include_imports \
--include_source_info \
--descriptor_set_out=api_descriptor.pb 

我的 api_config.yaml

type: google.api.Service
config_version: 3

name: backoffice.endpoints.MY_PROJECT.cloud.goog

title: Backoffice gRPC API
apis:
- name: package.BackofficeApi

usage:
  rules:
  - selector: "*"
    allow_unregistered_calls: true

我找不到有关此问题的任何信息...有什么想法吗?

【问题讨论】:

    标签: protocol-buffers grpc google-cloud-endpoints-v2


    【解决方案1】:

    很遗憾,这是 timestamp.proto 文件中的错误。

    它是been fixed,但听起来你的 protobuf 版本还没有修复。

    幸运的是,您可以在本地解决此问题 - 只需编辑 timestamp.proto(无论您在哪里获得它;这取决于您使用的软件包),将第 121 行的 --) 分解为最后的 --第 121 行和下一行的),因为它在当前文件中(上面链接)。

    【讨论】:

    • OK thks 修复。我正在使用 protobuf 3.5.1.1: brew list protobuf --versions protobuf 3.5.1_1
    • 我只是在 brew 上添加了一个 PR 来添加最后一个版本的 protobuf :github.com/Homebrew/homebrew-core/pull/26252
    【解决方案2】:

    protobuf 版本(3.5.0 - 3.5.2,截至 2018 年 5 月 9 日)中似乎存在此问题,并且尚未在任何版本中修复。我在"<python path>\Lib\site-packages\grpc_tools\_proto\google\protobuf\timestamp.proto"找到了有问题的文件

    换行:

    // http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime--)
    

    // http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime)
    

    帮我解决了问题

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-06-04
      • 1970-01-01
      • 2012-08-29
      • 2017-06-26
      • 1970-01-01
      • 2018-11-18
      • 2017-08-20
      相关资源
      最近更新 更多