ikenox
ikenox

Reputation: 21

Datastore emulator returns 'Only ancestor queries are allowed inside transactions’. Doesn't it support Firestore in Datastore mode?

I locally run my app which uses Datastore. The app is written in Java and uses Objectify. The code is like the below.

ofy().transact(() -> { ofy().load().type(PersonEntity.class).list(); })

This simple query runs successfully when my app connects to my GCP Project's Datastore.

But, when I use cloud-datastore-emulator, this query is rejected with an error message Only ancestor queries are allowed inside transactions.

This restriction about non-ancestor query seems to be removed on Firestore in Datastore mode. But cloud-datastore-emulator seems still restrict it.

My question is,

gcloud SDK version: 346.0.0

Upvotes: 1

Views: 369

Answers (1)

Rafael Lemos
Rafael Lemos

Reputation: 5829

Well, the answer to your question is: It should support it, as the emulator is suppose to support everything that the production environment does. That being said I did went through the documentation after seeing your question and found that here it's stated that:

The Cloud SDK includes a local emulator of the production Datastore mode environment.

But if you were to follow the link, there are hints that this is an emulator to both the legacy Datastore and Firestore in Datastore mode. So this might be why you are seeing this behavior. With that information at hand, it might be a good idea to open a case in Google's Issue Tracker so that they're engineering team can clarify if this is an expected behavior or not and if not, fix this issue.

Upvotes: 1

Related Questions