Skip to content

Firestore emulator does not support transactional queries #1583

@ranmocy

Description

@ranmocy

[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. (/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] }
}
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions