-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Confusing exception with GET methods and request bodies #126
Comments
@kryzthov Recording the issue you found so it can be improved. |
I have the same error using endpoints_proto_datastore @Bicycle.method(request_fields=('id',),
path='bikes/{id}', http_method='GET',
name='bikes.get')
def bikes_get(self, bike):
if not bike.from_datastore:
raise endpoints.NotFoundException('Bicycle (%s) not found.' % (bike.id,))
return bike Error
|
endpoints_proto_datastore is not a supported project, but I do intend to fix the original issue soon. |
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 |
I have exactly the same problem .. any improvement soon ? |
There is a workaround; do not have request body fields in GET requests. |
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? |
Can you explain why is this a no go for your team? |
GET requests are not supposed to have request bodies. |
Well maybe I don't understand it correctly. I have a annotation like: 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. |
However please note that endpoints_proto_datastore is not supported by this team. |
Thanks for the quick response. I will create a new issue. |
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.
Repro by cloning https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/appengine/standard/endpoints-frameworks-v2/echo/main.py and changing 'POST' to 'GET'
The text was updated successfully, but these errors were encountered: