I get this error on appengine when I run gcloud preview app run app.yaml
:
The --custom_entrypoint flag must be set for custom runtimes
My app.yaml
looks like:
version: 0-1-1
runtime: custom
vm: true
api_version: 1
manual_scaling:
instances: 1
handlers:
- url: .*
script: dynamic
My dockerfile is just:
FROM google/nodejs-runtime
I reinstalled gcloud
to get the latest version, did something change in the yaml config for managed VMs? This makes it impossible for me to test my app.
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)
来源:https://stackoverflow.com/questions/31280849/how-to-fix-the-custom-entrypoint-flag-must-be-set-for-custom-runtimes