GeezerVison is showing github.com — Error passing 'fields' to pubsub GET API for subscription · Issue #799 · googleapis/google-cloud-python
Error passing 'fields' to pubsub GET API for subscription #799Description$ tox -e regression --notest
GLOB sdist-make: /home/tseaver/projects/agendaless/Google/src/gcloud-python/setup.py
regression inst-nodeps: /home/tseaver/projects/agendaless/Google/src/gcloud-python/.tox/dist/gcloud-0.4.3.zip
___________________________________ summary ____________________________________
regression: skipped tests
congratulations :)
$ .tox/regression/bin/python regression/run_regression.py --package=pubsub
test_create_subscription (pubsub.TestPubsub) ... ERROR
test_create_topic (pubsub.TestPubsub) ... ok
test_list_subscriptions (pubsub.TestPubsub) ... ok
test_list_topics (pubsub.TestPubsub) ... ok
test_message_pull_mode_e2e (pubsub.TestPubsub) ... ERROR
ERROR: test_create_subscription (pubsub.TestPubsub)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/tseaver/projects/agendaless/Google/src/gcloud-python/regression/pubsub.py", line 74, in test_create_subscription
self.assertFalse(subscription.exists())
File "/home/tseaver/projects/agendaless/Google/src/gcloud-python/.tox/regression/lib/python2.7/site-packages/gcloud/pubsub/subscription.py", line 112, in exists
query_params={'fields': 'name'})
File "/home/tseaver/projects/agendaless/Google/src/gcloud-python/.tox/regression/lib/python2.7/site-packages/gcloud/connection.py", line 293, in api_request
raise make_exception(response, content)
gcloud.exceptions.BadRequest: 400 Invalid JSON payload received. Unknown name "fields": Cannot bind query parameter.
I omitted a similar failure in another test: both are for a call to subscription.exists() where the expected value is False.
@dhermes this is the one I was working around in #794
@jgeewax maybe tag w/ "google bug"? Activitydhermes commented on Apr 6, 2015 Whoa! @tmatsuo note that fields is in the discovery doc, but does not actually work when used.
@tseaver Shall we "fix" be re-implementing your previous commit? (PS Good thing exception handling is finally working the way we want :)) tseaver commented on Apr 6, 2015 ContributorAuthor More actions tseaver commented on Apr 6, 2015 ContributorAuthor More actions It would be nice to have confirmation that fields is not expected to be passed for non-existing subscriptions. @tmatsuo can you comment? tmatsuo commented on Apr 6, 2015 Actually it is the first time I'm aware of the fields query parameter.
@tseaver
Let me confirm, does this succeed with existing subscription, and fail with non-existing subscriptions? tseaver commented on Apr 6, 2015 ContributorAuthor More actions @tmatsuo I just tweaked our regression test to avoid the call for non-existing subscription, and saw the same failure for an existing subscription. tmatsuo commented on Apr 6, 2015 I think this is a bug within the new API infrastructure. I'll file a bug internally. tseaver commented on Apr 6, 2015 ContributorAuthor More actions I can provoke the 400 by supplying name in the fields input on the try it page tmatsuo commented on Apr 6, 2015 Thanks! Filed a bug with an id: 20091445 internally tmatsuo commented on Apr 6, 2015 I got a response.
"""
Could you try "$fields" instead?
"""
Actually I don't like the answer, but could you try it as suggested, just to see if it works? tseaver commented on Apr 7, 2015 ContributorAuthor More actions Using {"$fields": "name"} as query_params prevents the 400. tmatsuo commented on Apr 7, 2015 Thanks for confirming.
JFYI, if the fields -> $fields change is an official thing, we still need to fix bunch of things.
- API explorer shows "fields" query param and there is no way to override it.
- Documentations need to be updated
Do you have any opinions about it? dhermes commented on Apr 7, 2015
- It seems like a fix of something that wasn't broken.
- The discovery document still says
fields:
"fields": {
"type": "string",
"description": "Selector specifying which fields to include in a partial response.",
"location": "query"
},
- Does the APIs Explorer even have an owner?
- Note that @tseaver said the API accepted
fields when the subscription existed and $fields when it did not.
dhermes commented on Aug 28, 2015 Closing this. Will re-open if it matters to us.
The pub/sub folks shouldn't break users expectations though 😀
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|