How to fix "`The --custom_entrypoint flag must be set for custom runtimes`"?
Asked Answered
S

3

8

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.yamllooks 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.

Schmaltzy answered 7/7, 2015 at 23:1 Comment(4)
There was an earlier bug with Google Cloud SDK version 0.9.65, but should have been fixed. Can you verify what SDK version you have by running: gcloud version Related question and workaround is at: #30945821Baghdad
FYI - I am also seeing this error with Google Cloud SDK 0.9.67. I'm checking for a workaround or fix.Baghdad
Just to update, I rolled back to previous version 0.9.66 and no longer see the error. I ran: gcloud config set component_manager/fixed_sdk_version 0.9.66 -- To get back to latest, run: gcloud config unset component_manager/fixed_sdk_versionBaghdad
Thank you, this worked for me (don't forget to do gcloud components update after).Schmaltzy
B
7

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

Baghdad answered 8/7, 2015 at 19:54 Comment(0)
C
4

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.

Cottonseed answered 5/8, 2015 at 7:50 Comment(0)
I
0

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)
Imperturbation answered 8/7, 2015 at 18:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.