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

cloud firestore setup issue with ionic 3.7.1 #182

Closed
faraazc opened this issue Oct 4, 2017 · 7 comments
Closed

cloud firestore setup issue with ionic 3.7.1 #182

faraazc opened this issue Oct 4, 2017 · 7 comments

Comments

@faraazc
Copy link

faraazc commented Oct 4, 2017

[REQUIRED] Describe your environment

  • Operating System version: osx_10.12.2
  • Firebase SDK version: 4.5.0_
  • Firebase Product: cloud firestore_ (auth, database, storage, etc)

[REQUIRED] Describe the problem

Tried using ionic 3.x latest (3.7.1)
Updated firebase js sdk to 4.5.0.

Seeing below errors

ERROR Error: Uncaught (in promise): TypeError: __WEBPACK_IMPORTED_MODULE_2_firebase___default.a.firestore is not a function
TypeError: __WEBPACK_IMPORTED_MODULE_2_firebase___default.a.firestore is not a function

Steps to reproduce:

Relevant Code:

http://jsbin.com/rinilu/edit?js,console

// TODO(you): code here to reproduce the problem
import firebase from 'firebase';

var db = firebase.firestore();
@jshcrowthe
Copy link
Contributor

Hey @faraazc thanks for your interest in using Cloud Firestore! By default firebase.firestore is not included in the main bundle. You need to manually include the SDK in your package.

You should be able to modify the code you sent as follows and it should work:

import firebase from 'firebase';
import 'firebase/firestore';

var db = firebase.firestore();

Let me know if that works for you.

@dominikstrasser
Copy link

Hey.
i also had to
npm install @firebase/webchannel-wrapper --save-exact
don't know if this is only the case for my setup...

@jshcrowthe
Copy link
Contributor

I think it is probably an issue w/ your setup. I just tried a clean install and the @firebase/webchannel-wrapper package is installed w/o issue.

@faraazc
Copy link
Author

faraazc commented Oct 5, 2017

@jshcrowthe Thanks. Now it works after applying your suggestion.

should not firebase.firestore be part of main bundle?. it will be good so that we use like other firebase products like database,storage.

If there is any limitation in bundling with main, you may proceed to close this issue. for now it works for me with your suggestion

@jshcrowthe
Copy link
Contributor

Glad to hear it works for you @faraazc. We opted to omit the firestore SDK from the main bundle so that users don't have to incur the weight of Firestore in addition to database if they aren't using it.

Eventually we would like to push people more towards only using the pieces of the SDK that they actually need and to import them directly

i.e.

// Import the app directly 
import firebase from 'firebase/app';
import 'firebase/firestore';

firebase.firestore()...

@dominikstrasser if you can isolate and reproduce your issue please feel free to raise a new issue.

@kwes01
Copy link

kwes01 commented Dec 5, 2017

how you initialize the firebaseapp ??

@noor07
Copy link

noor07 commented Jan 31, 2018

Firebase.initializeApp() is not working i imported too. What should I do?

@firebase firebase locked and limited conversation to collaborators Oct 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants