This is a refinement and isolation of issue #1630 specifically related to firebase-admin breaking @firebase/testing. Even if no code is called in firebase-admin the issue still presents.
@firebase/testing doesn't return a firestore() instance when firebase-admin is a dependency in package.json.
Steps to reproduce
git clone https://github.com/firebase/quickstart-nodejs.gitcd quickstart-nodejs/firestore-emulator/javascript-quickstart/"firebase-admin": "7.3.0" to "dependencies" in package.json. __This is the step which reproduces the issue__npm installfirebase serve --only firestoreNow in the node the run the following code:
const firebase = require("@firebase/testing");
firebase.firestore()
This will produce an error:
Thrown:
TypeError: firebase.firestore is not a function
I found a few problems with this issue:
I have encountered this issue as well.
Firebase JS SDK and Firebase Admin SDK have some compatibility issues.
I provided detailed explanation and workarounds in https://github.com/firebase/firebase-js-sdk/issues/1696#issuecomment-501546596
Hope it helps.
Most helpful comment
I have encountered this issue as well.