firebase / firebase-tools

The Firebase Command Line Tools
MIT License
3.97k stars 915 forks source link

Emulator in datastore mode doesn't return "transaction" for lookup requests #7359

Closed onurdialpad closed 3 days ago

onurdialpad commented 1 week ago

[REQUIRED] Environment info

firebase-tools: 13.11.3

Platform: macOS

[REQUIRED] Test case

import requests

emulator_url = 'http://127.0.0.1:54510/v1/projects/testbed-test:lookup'

payload = b'{"keys": [{"partitionId": {"projectId": "testbed-test", "namespaceId": ""}, "path": [{"kind": "TestEntity", "id": "5348024557502464"}]}], "readOptions": {"newTransaction": {"readWrite": {}}}}'

headers = {'Content-Length': '191', '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()

# data must include "transaction" because payload has "readOptions": {"newTransaction": {"readWrite": {}}}, but it doesn't include the "transaction".

print(data)

[REQUIRED] Steps to reproduce

Described above

[REQUIRED] Expected behavior

"data" must contain "transaction" (datastore emulator returns it as expected) according to the reference page https://cloud.google.com/datastore/docs/reference/data/rest/v1/projects/lookup

[REQUIRED] Actual behavior

it doesn't include "transaction"

aalej commented 4 days ago

Thanks for the detailed report @onurdialpad! I’m able to reproduce the issue using the information provided. I’ll raise this to our engineering team so that they can take a look.

harshyyy21 commented 4 days ago

Hi @onurdialpad, thanks for raising this. The fix has been submitted and should be available within the next two weeks. Thanks!

onurdialpad commented 3 days ago

closing this one as it has been fixed