【问题标题】:How to fix "`The --custom_entrypoint flag must be set for custom runtimes`"?如何修复“必须为自定义运行时设置 --custom_entrypoint 标志”?
【发布时间】:2015-09-25 15:58:58
【问题描述】:

当我运行 gcloud preview app run app.yaml 时,我在 appengine 上收到此错误: The --custom_entrypoint flag must be set for custom runtimes

我的app.yaml看起来像:

version: 0-1-1
runtime: custom
vm: true
api_version: 1
manual_scaling:
  instances: 1

handlers:
  - url: .*
    script: dynamic

我的 dockerfile 只是: FROM google/nodejs-runtime

我重新安装了gcloud 以获取最新版本,托管虚拟机的 yaml 配置有什么变化吗?这让我无法测试我的应用。

【问题讨论】:

  • Google Cloud SDK 版本 0.9.65 存在较早的错误,但应该已修复。您能否通过运行验证您拥有的 SDK 版本:gcloud version 相关问题和解决方法位于:stackoverflow.com/questions/30945321/…
  • 仅供参考 - 我也看到 Google Cloud SDK 0.9.67 出现此错误。我正在检查解决方法或修复方法。
  • 只是为了更新,我回滚到以前的版本 0.9.66 并且不再看到错误。我跑了:gcloud config set component_manager/fixed_sdk_version 0.9.66 -- 要回到最新版本,运行:gcloud config unset component_manager/fixed_sdk_version
  • 谢谢,这对我有用(别忘了在之后做gcloud components update)。

标签: google-app-engine gcloud gcloud-node managed-vm


【解决方案1】:

注释行 391 到 397

google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/module.py

#      if (self._module_configuration.effective_runtime == 'custom' and
#          os.environ.get('GAE_LOCAL_VM_RUNTIME') != '0'):
#        if not self._custom_config.custom_entrypoint:
#          raise ValueError('The --custom_entrypoint flag must be set for '
#                           'custom runtimes')
#        else:
#          runtime_config.custom_config.CopyFrom(self._custom_config)

【讨论】:

    【解决方案2】:

    Google Cloud SDK 版本 0.9.67 似乎存在错误或设置问题,导致此错误。作为一种临时解决方法,您可以使用以下命令恢复到正常工作的以前的 SDK 版本:

    gcloud config set component_manager/fixed_sdk_version 0.9.66
    gcloud components update
    

    要返回 SDK 的当前版本,请运行:

    gcloud config unset component_manager/fixed_sdk_version
    gcloud components update
    

    这个问题出现在几个版本之前,在这里得到了解决: Running node.js on google cloud, but error running with docker

    【讨论】:

      【解决方案3】:

      您可以运行gcloud help preview app run 以显示描述运行命令及其参数的手册页。 --custom-entrypoint 描述为:

       --custom-entrypoint CUSTOM_ENTRYPOINT
          Specify an entrypoint for custom runtime modules. This is required when
          such modules are present. Include "{port}" in the string (without
          quotes) to pass the port number in as an argument. For instance:
          --custom_entrypoint="gunicorn -b localhost:{port} mymodule:application"
      

      请注意,错误消息为--custom_entrypoint,带有下划线,但参数为--customer_entrypoint,带有破折号。正确的名字是--custom-entrypoint 见:https://code.google.com/p/google-cloud-sdk/issues/detail?id=191

      对于一个 nodejs,你应该可以使用类似的东西:

      gcloud preview app run app.yaml --project=your-project-id --custom-entrypoint "node index.js {port}"
      

      取决于您启动应用程序的方式。该端口似乎也可用作环境变量 PORT,因此如果您的应用不处理命令行参数,则无需使用 {port}

      但是,我无法使用 npm start--custom-entrypoint 中的其他 npm run <script>

      【讨论】:

        猜你喜欢
        • 2021-10-25
        • 1970-01-01
        • 2013-04-08
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-03-10
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多