Closed
Description
[REQUIRED] Describe your environment
- Operating System version: ubuntu
- Browser version: n/a
- Firebase SDK version: 9.1.2
- Firebase Product: firestore, rules-unit-testing
[REQUIRED] Describe the problem
If I understand the comment from issue #5550 correctly...
..., but you can pass it to any function exported from the modular SDK where a modular Firestore is accepted, such as ref()
.
Originally posted by @Feiyang1 in #5550 (comment)
..., then the firestore object created with:
import { initializeTestEnvironment } from "@firebase/rules-unit-testing";
import type { FirebaseFirestore } from "@firebase/firestore-types";
const firestore: FirebaseFirestore = (await initializeTestEnvironment(projectId)).unauthenticatedContext().firestore();
should be allowed to pass to modular firestore functions such as ref()
but also(?) collection()
, doc()
, ... and runTransaction()
?
import { runTransaction } from "firebase/firestore";
runTransaction(firestore, () => { ... } );
However, when passing that firestore object to runTransaction
it throws the following error:
TypeError: firestore._freezeSettings is not a function
129 | const groupId = this.collection.newId();
130 |
> 131 | runTransaction(
| ^
132 | this.db,
133 | () => {
134 | if (!this.rootStore.user.divisionUser)
at configureFirestore (node_modules/@firebase/firestore/src/api/database.ts:196:30)
at ensureFirestoreConfigured (node_modules/@firebase/firestore/src/api/database.ts:189:5)
at runTransaction (node_modules/@firebase/firestore/src/api/transaction.ts:96:18)