0
votes

I am getting below error while accessing the api via explorer '_ah/api/explorer' or when api is called from the app.

Below is relevant piece from app.yaml and api implementation.

From other questions on stackoverflow it looks like this could happen if endpoint config is not deployed using gcloud service-management but event after uploading gatewayv1openapi.json I am getting similar error.

Is there something i need to change in api code or app.yaml? One more thing is that I have uploaded exact same codebase (only difference is other project id instead of ixp-test in app.yaml) to another old project and it works fine. Any newly created project is giving this error.

/_ah/api/gateway/v1/invoke?alt=json

no scheduler thread, scheduler.run() will be invoked by report(...) (/base/data/home/apps/s~ixp-test/20171013t215957.404774686885375478/server/lib/endpoints_management/control/client.py:235) Traceback (most recent call last): File "/base/data/home/apps/s~ixp-test/20171013t215957.404774686885375478/server/lib/endpoints_management/control/client.py", line 231, in start self._thread.start() File "/base/data/home/runtimes/python27_experiment/python27_lib/versions/1/google/appengine/api/background_thread/background_thread.py", line 108, in start start_new_background_thread(self.bootstrap, ()) File "/base/data/home/runtimes/python27_experiment/python27_lib/versions/1/google/appengine/api/background_thread/background_thread.py", line 87, in start_new_background_thread raise ERROR_MAPerror.application_error FrontendsNotSupported . . . (/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 96, in LoadObject __import(cumulative_path) File "/base/data/home/apps/s~ixp-test/20171013t215957.404774686885375478/server/main.py", line 18, in api = endpoints.api_server([GatewayApi]) File "/base/data/home/apps/s~ixp-test/20171013t215957.404774686885375478/server/lib/endpoints/apiserving.py", line 514, in api_server controller) File "/base/data/home/apps/s~ixp-test/20171013t215957.404774686885375478/server/lib/endpoints_management/control/wsgi.py", line 126, in add_all a_service = loader.load() File "/base/data/home/apps/s~ixp-test/20171013t215957.404774686885375478/server/lib/endpoints_management/control/service.py", line 111, in load return self._load_func(**kw) File "/base/data/home/apps/s~ixp-test/20171013t215957.404774686885375478/server/lib/endpoints_management/config/service_config.py", line 79, in fetch_service_config _log_and_raise(Exception, message_template.format(status_code)) File "/base/data/home/apps/s~ixp-test/20171013t215957.404774686885375478/server/lib/endpoints_management/config/service_config.py", line 127, in _log_and_raise raise exception_class(message) Exception: Fetching service config failed (status code 403)

Below is the relevant config

app.yaml

runtime: python27
api_version: 1
threadsafe: false
automatic_scaling:
  max_idle_instances: 0


env_variables:
  ENDPOINTS_SERVICE_NAME: ixp-test.appspot.com
  ENDPOINTS_SERVICE_VERSION: 2017-08-13r0

API

@endpoints.api(name='gateway', version='v1')
class GatewayApi(remote.Service):
    @endpoints.method(
        GatewayRequest,
        GatewayResponse,
        path='invoke',
        http_method='POST',
        name='invoke')
    def invoke(self, request):
        pass
    @endpoints.method(
        GatewayRequest,
        GatewayResponse,
        path='invokeSecure',
        http_method='POST',
        name='invokeSecure',
        scopes=[endpoints.EMAIL_SCOPE])
    def invoke_secure(self, request):
        pass
2

2 Answers

1
votes

This might well happen if the service name in the gatewayv1openapi.json doesn't match the service name in the app.yaml; can you double-check that?

0
votes

Managed to resolve it. Issue was due to not updating

ENDPOINTS_SERVICE_VERSION: 2017-08-13r0

for new project. Value from old deployed project for which it was working caused the error.

from getting started tutorial

gcloud service-management deploy echov1openapi.json
Service Configuration [2017-02-13-r2] uploaded for service [example-project.appspot.com]