How do I structure Cloud Functions for Firebase to deploy multiple functions from multiple files?

I would like to create multiple Cloud Functions for Firebase and deploy them all at the same time from one project. I would also like to separate each function into a separate file. Currently I can create multiple functions if I put them both in index.js such as: exports.foo = functions.database.ref(‘/foo’).onWrite(event => { … }); … Read more

Enabling CORS in Cloud Functions for Firebase

I’m currently learning how to use new Cloud Functions for Firebase and the problem I’m having is that I can’t access the function I wrote through an AJAX request. I get the “No ‘Access-Control-Allow-Origin’” error. Here’s an example of the function I wrote: exports.test = functions.https.onRequest((request, response) => { response.status(500).send({test: ‘Testing functions’}); }) The function … Read more

How to use Google App Engine with my own naked domain (not subdomain)?

After hours of reading about and experimenting with DNS records I can access my Google App Engine app via these URLs: myappid.appspot.com www.myappid.myowndomain.com What does not work: myowndomain.com www.myowndomain.com I want to be able to serve my app directly off my domain and not a subdomain. I’ve seen apps that do this. Is there any … Read more

What is Firebase Firestore ‘Reference’ data type good for?

I’m just exploring the new Firebase Firestore and it contains a data type called reference. It is not clear to me what this does. Is it like foreign key? Can it be used to point to a collection that is located somewhere else? If reference is an actual reference, can I use it for queries? … Read more

What’s the difference between Cloud Firestore and the Firebase Realtime Database?

Google just released Cloud Firestore, their new Document Database for apps. I have been reading the documentation but I don’t see a lot of differences between Firestore and Firebase DB. The main point is that Firestore uses documents and collections which allow the easy use of querying compared to Firebase, which is a traditional noSQL … Read more

How to change the project in GCP using CLI commands

How can I change the current running project to another project in GCP (Google Cloud Platform) account using cli commands other than using gcloud init manually? gcloud projects list will list the projects running on my account. I want to change the current project to any other project from the list using a cli command. … Read more