Google Cloud: @endpoints.api, 'module' object has no attribute 'api'

584 Views Asked by At

While trying to appcfg.py update myProject, my endpoints failed to update. Here is part of the trace:

09:36 PM Failed to update Endpoints configuration.  The app returned an error when the Google Cloud Endpoints server attempted to communicate with it.
09:36 PM See the deployment troubleshooting documentation for more information: https://developers.google.com/appengine/docs/python/endpoints/test_deploy#troubleshooting_a_deployment_failure
09:36 PM Ignoring Endpoints failure and proceeding with update.

I tried to check the logs at http://localhost:8080/_ah/spi/BackendService.getApiConfigs, but terminal produces the following error:

@endpoints.api(name='EventsAPI', version='v1')
AttributeError: 'module' object has no attribute 'api'
INFO     2016-03-18 02:01:37,742 module.py:787] default: "GET /_ah/spi/BackendService.getApiConfigs HTTP/1.1" 500 -

Here is my code:

import endpoints
from protorpc import messages
from protorpc import message_types
from protorpc import remote

package = 'Events'

@endpoints.api(name='EventsAPI', version='v1')
class EventsAPI(remote.Service):
    # insert lots of endpoint methods

APPLICATION = endpoints.api_server([EventsAPI])

I am following this tutorial. Where did I go wrong?

2

There are 2 best solutions below

0
hyang123 On BEST ANSWER

There is a problem with the endpoints' name. The name EventsAPI is invalid; changing it to eventsapi fixed this issue.

0
Zeehad On

For reference, as outlined in the endpoint definitions.

The name value: Must begin with lowercase.