Giter VIP home page Giter VIP logo

Comments (11)

MichaelSolati avatar MichaelSolati commented on May 31, 2024

I don't think this is a Geofirestore question as much as this is a Firebase Functions question. Either way, I'd tell you to do more research and reading the docs of firebase functions, because you dont need to import * as firebase from 'firebase'; And if you need to create a collectionref for geofirestore you could do...

import * as admin from 'firebase-admin';

const collectionRef = admin.firestore().collection('collection');

from geofirestore-js.

stubborncoder avatar stubborncoder commented on May 31, 2024

I know that admin is the normal way to query collections un cloud functions however if you try to assign that collectionRef to a new Geofirestore(collectionRef), you will get a casting error as Geofirestore "firebase.firestore.CollectionReference", firebase-admin's collection type "FirebaseFirestore.CollectionReference", In another thread @invention7 sugested to import firebase package instead of admin, but as I show you before even importing Geofirestore as its simplest way throws that error at build.

from geofirestore-js.

invention7 avatar invention7 commented on May 31, 2024

I agree with @stubborncoder that firebase-admin's 'collection' type appears to be incompatible with the collection type expected by the geofirestore constructor. To get around this, I created by collectionRef with the 'firebase' library.

Maybe, @MichaelSolati , there is an opportunity for Geofirestore in expanding the constructor to allow the firebase-admin's collection... but in terms of David's immediate need, I think it can be handled as-s.

@stubborncoder, in your firebase config, have you disabled persistence?

e.g.
PersistenceEnabled: false
?

from geofirestore-js.

stubborncoder avatar stubborncoder commented on May 31, 2024

Hi @invention7 my firebaseconfig wasn't modified at all, it's just as it's created by the firebase CLI... thanks for your help!, Edited: don't really know if this setting comes as false or true by default...

from geofirestore-js.

MichaelSolati avatar MichaelSolati commented on May 31, 2024

I'd be open to a PR if anyone wants to expand the types allowed. I'd also ask that the PR is made towards the dev branch.

from geofirestore-js.

invention7 avatar invention7 commented on May 31, 2024

Hey @stubborncoder, sorry I missed your comment... try downgrading firebase to '5.0.0' (ie 'npm install [email protected]')

from geofirestore-js.

MichaelSolati avatar MichaelSolati commented on May 31, 2024

In general I can probably double type everything (it would just take a while to get through). You should also be able to // @ts-ignore type issues for now. While it's not the end all be all solution, it should work until I dual type everything.

from geofirestore-js.

stubborncoder avatar stubborncoder commented on May 31, 2024

@invention7 that did the trick m8, I downgraded as you suggested and now it builds and runs without any further issues!. Thank you very much!.

from geofirestore-js.

invention7 avatar invention7 commented on May 31, 2024

np @stubborncoder ! Good luck!!

from geofirestore-js.

invention7 avatar invention7 commented on May 31, 2024

oh wow! awesome @MichaelSolati !

from geofirestore-js.

MichaelSolati avatar MichaelSolati commented on May 31, 2024

Thank you @invention7 !

For everyone else, Firebase Functions should work (may need to make a small patch, but for the most part it's good to go). Try npm i [email protected]

from geofirestore-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.