Using Firestore wirt ember

Firebase is working very nicely with ember. I would like to use Firestore to store my pictures on the server. Do you thing it’s a good idea? Do you know where I can find a tutorial to upload/download files to firestore and manage this medias in the Firebase.

Firestore isn’t made for storing files. Have you seen Cloud Storage for Firebase | Store and serve content with ease?

That being said, official support for Firestore via the Emberfire addon is still being worked on: Cloud Firestore Support? · Issue #529 · FirebaseExtended/emberfire · GitHub. You can try out GitHub - mikkopaderes/ember-cloud-firestore-adapter: Unofficial Ember Data Adapter and Serializer for Cloud Firestore instead.

If you’re looking to store pictures, Cloudinary is also a fine alternative that comes with uploader plugins etc.

Thank you for your help. You are right I was confused between Firestore and Firebase storage! I make some test with Cloudinary, it looks very powerful but unfortunately at this time it didn’t success to upload. I am looking to Firebase storage again and I make some progress, this is my controller:

import Controller from ‘@ember/controller’;

import { inject as service } from ‘@ember/service’;

export default Controller.extend({

firebaseApp: service(),

actions: {

	didSelectFiles(files)
			{
            var storage = this.get('firebaseApp').storage;
			console.log("storage : "+ storage);
			var storageRef = storage.ref();
			console.log("storageRef : "+storageRef);
			}
	}

});

I get this answers ;

storage : function () { [native code] }

storageRef: Uncaught TypeError: storage.ref is not a function

what’s wrong in my code?

I get it! I should use firebaseUtil service instead firebaseApp. this.get(‘firebaseUtil’).uploadFile() is working. So easy when you know.

1 Like

@vincenthure, are you using emberfire-utils? If so, be warned that it’s deprecated. You should just stick to the native Firebase Storage API which was originally what you were using through the firebaseApp service. The problem with your code is that you should’ve executed the storage as a function rather than just a property.

var storage = this.get('firebaseApp').storage();

Thank you, I have changed my code to use “firebaseApp” service and now it work