Skip to content
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

start_after(None) and the like should be a no-op and shouldn't result in an error #439

Closed
crwilcox opened this issue Sep 1, 2021 · 0 comments · Fixed by #440
Closed
Labels
api: firestore Issues related to the googleapis/python-firestore API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@crwilcox
Copy link
Contributor

crwilcox commented Sep 1, 2021

Attempting to execute a query with a start_after(None) will fail. This should be a no-op.

client = firestore.Client()
col = client.collection('0-test-collection-0')
query = col.order_by('__name__').start_after(None)
for doc in query.stream():
    print(doc)
  File "/Users/crwilcox/scratch/python-firestore/venv/lib/python3.8/site-packages/google/cloud/firestore_v1/base_query.py", line 758, in _normalize_cursor
    if len(document_fields) > len(orders):
TypeError: object of type 'NoneType' has no len()

I'd expect start_after, start_at, end_at, end_before to manage a None field handed to them.

@product-auto-label product-auto-label bot added the api: firestore Issues related to the googleapis/python-firestore API. label Sep 1, 2021
@crwilcox crwilcox added priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Sep 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: firestore Issues related to the googleapis/python-firestore API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant