How to fix “`The --custom_entrypoint flag must be set for custom runtimes`”?

坚强是说给别人听的谎言 提交于 2019-11-30 20:18:22
Jeff Deskins

There appears to be a bug or setup issue with Google Cloud SDK version 0.9.67 causing this error. As a temporary workaround, you can revert to previous SDK version, which is working, with the following commands:

gcloud config set component_manager/fixed_sdk_version 0.9.66
gcloud components update

To return to the current version of the SDK, run:

gcloud config unset component_manager/fixed_sdk_version
gcloud components update

This issue appeared a few versions ago and was addressed here: Running node.js on google cloud, but error running with docker

You can run gcloud help preview app run to show a man page describing the run command and its parameters. --custom-entrypoint is described as:

 --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"

Note that the error message says --custom_entrypoint, with an underscore, but the parameter is --customer_entrypoint, with a dash. The correct name is --custom-entrypoint see: https://code.google.com/p/google-cloud-sdk/issues/detail?id=191

For a nodejs you should be able to use something like:

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

Depending on how you start your application. The port seems to also be available as the environment variable PORT so you don't need to use {port} if your app does not handle command line arguments.

I haven't been able to use npm start or other npm run <script> from the --custom-entrypoint however.

Comment lines 391 to 397 in

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)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!