firebase-tools icon indicating copy to clipboard operation
firebase-tools copied to clipboard

Emulator in datastore mode doesn't return "endCursor" while Datastore emulator returns for the same query

Open onurdialpad opened this issue 1 year ago • 6 comments

[REQUIRED] Environment info

firebase-tools: 7.16.1

Platform: macOS

[REQUIRED] Test case

import requests

emulator_url = 'http://127.0.0.1:50579/v1/projects/test-app:runQuery'

payload = b'{"partitionId": {"projectId": "test-app", "namespaceId": ""}, "query": {"kind": [{"name": "Profile"}], "limit": 1}, "readOptions": {"readConsistency": "EVENTUAL"}}'

headers = {'Content-Length': '169', 'Content-Type': 'application/json'}

# POST request to the emulator
resp = requests.post(emulator_url, headers=headers, data=payload)

# check response's data
data = resp.json()
print(data)
# prints {'batch': {'entityResultType': 'FULL', 'moreResults': 'MORE_RESULTS_AFTER_LIMIT', 'readTime': '2024-06-21T20:20:20.928406Z'}} no "endCursor" within the data.

[REQUIRED] Steps to reproduce

Explained above

[REQUIRED] Expected behavior

You will see something like {'entityResultType': 'FULL', 'moreResults': 'MORE_RESULTS_AFTER_LIMIT', 'readTime': '2024-06-20T21:40:28.228019Z'}

[REQUIRED] Actual behavior

Datastore emulator returns {'endCursor': 'CgA=', 'entityResultType': 'FULL', 'moreResults': 'MORE_RESULTS_AFTER_LIMIT'} which is close to the production env

onurdialpad avatar Jun 20 '24 22:06 onurdialpad