Firestore emulator does not support transactional queries
See original GitHub issue[REQUIRED] Environment info
7.2.2
firebase-tools: 7.2.2
Platform: macOS 10.14.5
[REQUIRED] Test case
export const myFunction = functions.https.onCall(
async (data: any, context: CallableContext): Promise<void> => {
const db = admin.firestore();
const my_collection: CollectionReference = db.collection(`test_collection`);
return await db.runTransaction<void>(async (transaction) => {
const result = await transaction.get(my_collection.doc());
console.debug(result); // This works
await transaction.get(my_collection.limit(1));
// This will crash
});
});
[REQUIRED] Steps to reproduce
Run firebase emulators:start
and call the function from Web App
[REQUIRED] Expected behavior
Emulator should just work as production
[REQUIRED] Actual behavior
Unhandled error Error at Http2CallStream.<anonymous> (/PATH_TO_PROJECT/functions/node_modules/@grpc/grpc-js/build/src/call.js:68:41) at Http2CallStream.emit (events.js:208:15) at /PATH_TO_PROJECT/functions/node_modules/@grpc/grpc-js/build/src/call-stream.js:71:22 at processTicksAndRejections (internal/process/task_queues.js:75:11) { code: 2, details: ‘’, metadata: Metadata { options: undefined, internalRepr: Map { ‘content-type’ => [Array] } } }
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Connect your app to the Cloud Firestore Emulator - Firebase
Local Emulator Suite supports emulation of real Firebase projects and demo ... The emulator does not currently implement all transaction behavior seen in ......
Read more >Datastore emulator returns 'Only ancestor queries are allowed ...
Datastore emulator returns 'Only ancestor queries are allowed inside transactions'. Doesn't it support Firestore in Datastore mode? Ask Question.
Read more >Cloud Firestore | FlutterFire
Cloud Firestore does not support the following types of queries: Queries with range filters on different fields, as described in the previous section....
Read more >Projects - OpenTeams, Inc.
Creating a ref does not involve any network traffic. ... This package supports the Cloud Firestore emulator, which is useful for testing and...
Read more >Emulate Firestore locally | Google Cloud
Do not use the emulator for production deployments. Because the emulator stores data only in memory, it will not persist data across runs....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Totally reasonable. There is a bit of work needed in order to support this without breaking the normal concurrency handling, but it’s very doable. I’ll keep this issue open to track the progress.
That is a reasonable concern. If you ask me, I would say for an emulator, firstly it should allow any legitimate client code to run against it, and latter to behave as close to production version as possible. So I think it’s totally reasonable to minimize the support on concurrency cases.
That being said, would it be possible to have some simple implementation without support of concurrency first? That would allow us to write test for our Firebase functions which rely on Firestore heavily, where mocking Firestore doesn’t make a lot sense.
Thanks!