Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@firebase/testing doesn't return firestore() instance when firebase-admin is a dependency #1786

Open
stamler opened this issue May 16, 2019 · 4 comments
Labels
feature request testing-sdk testing with emulator

Comments

@stamler
Copy link

stamler commented May 16, 2019

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

@google-oss-bot
Copy link
Contributor

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.

@themikejr
Copy link

I have encountered this issue as well.

@Feiyang1
Copy link
Member

Firebase JS SDK and Firebase Admin SDK have some compatibility issues.
I provided detailed explanation and workarounds in #1696 (comment)

Hope it helps.

@akauppi
Copy link

akauppi commented Mar 18, 2021

Note to people seeing this after 2019: @firebase/testing is now @firebase/rules-unit-testing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request testing-sdk testing with emulator
Projects
None yet
Development

No branches or pull requests

6 participants