Firebase-js-sdk: @firebase/testing doesn't return firestore() instance when firebase-admin is a dependency

Created on 16 May 2019  路  3Comments  路  Source: firebase/firebase-js-sdk

Environment

  • Operating System version: macOS 10.14.4
  • Browser version: Safari 12.1
  • Firebase SDK version: @firebase/testing 0.7.9 through 0.9.4
  • Firebase Product: @firebase/testing and firebase-admin

Description

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

  1. git clone https://github.com/firebase/quickstart-nodejs.git
  2. cd quickstart-nodejs/firestore-emulator/javascript-quickstart/
  3. add "firebase-admin": "7.3.0" to "dependencies" in package.json. __This is the step which reproduces the issue__
  4. npm install
  5. firebase serve --only firestore

Now 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

testing-sdk

Most helpful comment

I have encountered this issue as well.

All 3 comments

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

colinskow picture colinskow  路  4Comments

suparnavg picture suparnavg  路  3Comments

mrfambo picture mrfambo  路  4Comments

mohshraim picture mohshraim  路  3Comments

Kosai106 picture Kosai106  路  3Comments