You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 19, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Apr 19, 2026. It is now read-only.
Confusing exception with GET methods and request bodies #126
If a method is defined with http_method GET and the method has a message or resource container as the request body, and that request body has fields which aren't in the resource container, a strange and confusing exception arises.
descriptor = self.get_openapi_dict(services, hostname)
File "/usr/local/google/home/rhd/appflex/python-docs-samples/appengine/standard/endpoints-frameworks-v2/echo/lib/endpoints/openapi_generator.py", line 1011, in get_openapi_dict
return self.__api_openapi_descriptor(services, hostname=hostname)
File "/usr/local/google/home/rhd/appflex/python-docs-samples/appengine/standard/endpoints-frameworks-v2/echo/lib/endpoints/openapi_generator.py", line 915, in __api_openapi_descriptor
security_definitions)
File "/usr/local/google/home/rhd/appflex/python-docs-samples/appengine/standard/endpoints-frameworks-v2/echo/lib/endpoints/openapi_generator.py", line 726, in __method_descriptor
path)
File "/usr/local/google/home/rhd/appflex/python-docs-samples/appengine/standard/endpoints-frameworks-v2/echo/lib/endpoints/openapi_generator.py", line 589, in __request_message_descriptor
method_id)
File "/usr/local/google/home/rhd/appflex/python-docs-samples/appengine/standard/endpoints-frameworks-v2/echo/lib/endpoints/openapi_generator.py", line 543, in __params_descriptor
params.append(self.__body_parameter_descriptor(method_id))
File "/usr/local/google/home/rhd/appflex/python-docs-samples/appengine/standard/endpoints-frameworks-v2/echo/lib/endpoints/openapi_generator.py", line 365, in __body_parameter_descriptor
self.__request_schema[method_id])
KeyError: 'echo.echo'
I have the same error using endpoints_proto_datastore
@Bicycle.method(request_fields=('id',),path='bikes/{id}', http_method='GET',name='bikes.get')defbikes_get(self, bike):
ifnotbike.from_datastore:
raiseendpoints.NotFoundException('Bicycle (%s) not found.'% (bike.id,))
returnbike
Error
Traceback (most recent call last):
File "lib/endpoints/endpointscfg.py", line 31, in <module>
main(sys.argv)
File "C:\Users\Danier\Projects\bikestore\lib\endpoints\_endpointscfg_impl.py", line 634, in main
args.callback(args)
File "C:\Users\Danier\Projects\bikestore\lib\endpoints\_endpointscfg_impl.py", line 487, in _GenOpenApiSpecCallback
application_path=args.application)
File "C:\Users\Danier\Projects\bikestore\lib\endpoints\_endpointscfg_impl.py", line 332, in _GenOpenApiSpec
application_path=application_path)
File "C:\Users\Danier\Projects\bikestore\lib\endpoints\_endpointscfg_impl.py", line 214, in GenApiConfig
services, hostname=hostname))
File "C:\Users\Danier\Projects\bikestore\lib\endpoints\openapi_generator.py", line 1028, in pretty_print_config_to_json
descriptor = self.get_openapi_dict(services, hostname)
File "C:\Users\Danier\Projects\bikestore\lib\endpoints\openapi_generator.py", line 1014, in get_openapi_dict
return self.__api_openapi_descriptor(services, hostname=hostname)
File "C:\Users\Danier\Projects\bikestore\lib\endpoints\openapi_generator.py", line 918, in __api_openapi_descriptor
security_definitions)
File "C:\Users\Danier\Projects\bikestore\lib\endpoints\openapi_generator.py", line 729, in __method_descriptor
path)
File "C:\Users\Danier\Projects\bikestore\lib\endpoints\openapi_generator.py", line 592, in __request_message_descriptor
method_id)
File "C:\Users\Danier\Projects\bikestore\lib\endpoints\openapi_generator.py", line 546, in __params_descriptor
params.append(self.__body_parameter_descriptor(method_id))
File "C:\Users\Danier\Projects\bikestore\lib\endpoints\openapi_generator.py", line 367, in __body_parameter_descriptor
self.__request_schema[method_id])
KeyError: 'bikestore.bikes.get'
I can confirm the issue with endpoints_proto_datastore yielding the key error. Easily reproduced by following the simple_get example. We spent a bunch of time troubleshooting this and another issue related to custom ndb properties before deciding to use endpoints framework directly.
We also have exactly the same problem. So you suggest as a workaround change al GET request to POST requests? For a temporary workaround in development it will be sufficient, but for production it's a no-go for my team. Is it likely to be resolved soon?
Well maybe I don't understand it correctly. I have a annotation like:
@ExampleModel.method(
request_fields=('playerId',),
path='example/stats/{playerId}',
http_method='GET',
name='example.stats',
user_required=True)
When I generate the openapi spec I get KeyError: 'api.example.stats'. Did I do something wrong?
@truepants, that would be a different problem entirely; this issue is about exceptions that occur while handling GET requests that contain request bodies.
Please open a new issue with your full traceback and the code which reproduces it, and I can have a look.
Activity
inklesspen commentedon Nov 29, 2017
@kryzthov Recording the issue you found so it can be improved.
danierdev commentedon Feb 14, 2018
I have the same error using endpoints_proto_datastore
Error
inklesspen commentedon Feb 14, 2018
endpoints_proto_datastore is not a supported project, but I do intend to fix the original issue soon.
winsomniak commentedon Feb 15, 2018
Hi @inklesspen
I can confirm the issue with endpoints_proto_datastore yielding the key error. Easily reproduced by following the simple_get example. We spent a bunch of time troubleshooting this and another issue related to custom ndb properties before deciding to use endpoints framework directly.
While I can appreciate that endpoints_proto_datastore is not an official part of endpoints, it is promoted directly from the from the docs.
Not sure who maintains the site, but it would probably save people time and frustration to make a note of current issues or remove the recommendation.
Cheers
tolsac commentedon May 15, 2018
I have exactly the same problem .. any improvement soon ?
inklesspen commentedon May 15, 2018
There is a workaround; do not have request body fields in GET requests.
truepants commentedon May 30, 2018
We also have exactly the same problem. So you suggest as a workaround change al GET request to POST requests? For a temporary workaround in development it will be sufficient, but for production it's a no-go for my team. Is it likely to be resolved soon?
tangiel commentedon May 30, 2018
Can you explain why is this a no go for your team?
inklesspen commentedon May 30, 2018
GET requests are not supposed to have request bodies.
truepants commentedon May 30, 2018
Well maybe I don't understand it correctly. I have a annotation like:
@ExampleModel.method(
request_fields=('playerId',),
path='example/stats/{playerId}',
http_method='GET',
name='example.stats',
user_required=True)
When I generate the openapi spec I get KeyError: 'api.example.stats'. Did I do something wrong?
inklesspen commentedon May 30, 2018
@truepants, that would be a different problem entirely; this issue is about exceptions that occur while handling GET requests that contain request bodies.
Please open a new issue with your full traceback and the code which reproduces it, and I can have a look.
inklesspen commentedon May 30, 2018
However please note that endpoints_proto_datastore is not supported by this team.
truepants commentedon May 30, 2018
Thanks for the quick response. I will create a new issue.