6

I am implementing the steps in the Quickstart.

I did notice another question on this. I double checked that env_variables section in app.yaml has the right values for ENDPOINTS_SERVICE_NAME and ENDPOINTS_SERVICE_VERSION.

../_ah/api/explorer doesn't show any endpoint under 'Services'.

What is this error and how to fix it?

Error log shows:

 (/base/data/home/runtimes/python27_experiment/python27_lib/versions/1/google/appengine/runtime/wsgi.py:263)
Traceback (most recent call last):
  File "/base/data/home/runtimes/python27_experiment/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 240, in Handle
    handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
  File "/base/data/home/runtimes/python27_experiment/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 299, in _LoadHandler
    handler, path, err = LoadObject(self._handler)
  File "/base/data/home/runtimes/python27_experiment/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 85, in LoadObject
    obj = __import__(path[0])
  File "/base/data/home/apps/s~test-app-129421/20170217t185546.399267289806711006/main.py", line 103, in <module>
    api = endpoints.api_server([EchoApi])
  File "/base/data/home/apps/s~test-app-129421/20170217t185546.399267289806711006/lib/endpoints/apiserving.py", line 520, in api_server
    controller)
  File "/base/data/home/apps/s~test-app-129421/20170217t185546.399267289806711006/lib/google/api/control/wsgi.py", line 121, in add_all
    a_service = loader.load()
  File "/base/data/home/apps/s~test-app-129421/20170217t185546.399267289806711006/lib/google/api/control/service.py", line 110, in load
    return self._load_func(**kw)
  File "/base/data/home/apps/s~test-app-129421/20170217t185546.399267289806711006/lib/google/api/config/service_config.py", line 78, in fetch_service_config
    _log_and_raise(Exception, message_template.format(status_code))
  File "/base/data/home/apps/s~test-app-129421/20170217t185546.399267289806711006/lib/google/api/config/service_config.py", line 126, in _log_and_raise
    raise exception_class(message)
Exception: Fetching service config failed (status code 404)
Community
  • 1
  • 1
user362953
  • 435
  • 2
  • 13

5 Answers5

4

I had the same Exception trace, except mine was a 403. Hope is helpful to others having the same frustration I had.

Exception: Fetching service config failed (status code 403)

I finally found that in my app.yaml it had this from the GIT clone

ENDPOINTS_SERVICE_NAME: echo-api.endpoints.[YOUR-PROJECT-ID].cloud.goog

And the Quickstart only directed me to replace YOUR-PROJECT-ID.

I had to also replace .cloud.goog with .appspot.com

bourne2program
  • 121
  • 1
  • 5
3

I have app call myapp

First show services:

D:\projects\barcode\ebk>gcloud service-management configs list --service=myapp.appspot.com
CONFIG_ID     SERVICE_NAME
2017-06-29r3  myapp.appspot.com
2017-06-29r2  myapp.appspot.com
2017-06-29r1  myapp.appspot.com
2017-06-29r0  myapp.appspot.com

You can see first line in result is 2017-06-29r3 myapp.appspot.com, edit app.yaml:

env_variables:
  # The following values are to be replaced by information from the output of
  # 'gcloud service-management deploy swagger.json' command.
  ENDPOINTS_SERVICE_NAME: myapp.appspot.com
  ENDPOINTS_SERVICE_VERSION: 2017-06-29r3

This works for me

nguyên
  • 5,156
  • 5
  • 43
  • 45
1

If fetching the service config failed with a 404, then the gcloud service-management deploy step probably didn't work as expected. I would try that step again, making sure that everything is configured correctly, and make sure that the command finishes with no errors.

  • Thanks Brad. I will look into the log for that step. Those looking for how I could fix this: I happened to approach the problem by using a different working example as template and could get it working through that. – user362953 Feb 21 '17 at 01:12
0

You just need to follow these steps:

  1. Display the service configuration ID by running the following command:

    gcloud endpoints configs list --service=echo-api.endpoints.[PROJECT-ID].cloud.goog
    
  2. Replace [PROJECT-ID] with your project ID. Do not include the square brackets.

  3. Edit the app.yaml file in the python-docs-samples/appengine/standard/endpoints-frameworks-v2/echo directory, and make the following changes in the env_variables section:

    env_variables:
      # Replace with your endpoints service name.
      ENDPOINTS_SERVICE_NAME: "echo-api.endpoints.[PROJECT-ID].cloud.goog"
      # Replace with the version Id of your uploaded Endpoints service.
      ENDPOINTS_SERVICE_VERSION: "[YOUR-SERVICE-CONFIG-ID]"
    
  4. Replace [PROJECT-ID] with your project ID and [YOUR-SERVICE-CONFIG-ID] with your service configuration ID from the previous step. Do not include the square brackets. For example:

    env_variables:
      # Replace with your endpoints service name.
      ENDPOINTS_SERVICE_NAME: "echo-api.endpoints.example-project.cloud.goog"
      # Replace with the version Id of your uploaded Endpoints service.
      ENDPOINTS_SERVICE_VERSION: "2016-12-14r1"
    

You just need to choose one of the options shown on the first command.

Denis Raison
  • 41
  • 1
  • 1
  • 6
  • I believe this is now `gcloud services list` - replacing `gcloud service-management configs list` – Jack May 16 '18 at 19:34
  • Now they have a group specific for endpoints, I assume the command would look a bit like that now: `gcloud endpoints configs list --service=echo-api.endpoints.[PROJECT-ID].cloud.goog` – Denis Raison May 17 '18 at 23:29
0

While using Cloud Endpoint, must make sure the config ID is the same as in app.yaml

gcloud endpoints configs list --service=myapp.appspot.com

Result:

CONFIG_ID     SERVICE_NAME
2018-08-13r0  myapp.appspot.com

In app.yaml

ENDPOINTS_SERVICE_VERSION: 2018-08-13r0
Mike Yang
  • 2,581
  • 3
  • 24
  • 27